Search in sources :

Example 1 with MailjetClient

use of com.mailjet.client.MailjetClient in project java-docs-samples by GoogleCloudPlatform.

the class MailjetSender method main.

public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {
    final String mailjetApiKey = "YOUR-MAILJET-API-KEY";
    final String mailjetSecretKey = "YOUR-MAILJET-SECRET-KEY";
    MailjetClient client = new MailjetClient(mailjetApiKey, mailjetSecretKey, new ClientOptions("v3.1"));
    MailjetSender sender = new MailjetSender();
    sender.sendMailjet(args[0], args[1], client);
}
Also used : ClientOptions(com.mailjet.client.ClientOptions) MailjetClient(com.mailjet.client.MailjetClient)

Example 2 with MailjetClient

use of com.mailjet.client.MailjetClient in project teammates by TEAMMATES.

the class MailjetService method sendEmailWithService.

@Override
protected void sendEmailWithService(EmailWrapper wrapper) throws MailjetException, MailjetSocketTimeoutException {
    MailjetRequest email = parseToEmail(wrapper);
    MailjetClient mailjet = new MailjetClient(Config.MAILJET_APIKEY, Config.MAILJET_SECRETKEY);
    MailjetResponse response = mailjet.post(email);
    if (isNotSuccessStatus(response.getStatus())) {
        log.severe("Email failed to send: " + response.getData().toString());
    }
}
Also used : MailjetClient(com.mailjet.client.MailjetClient) MailjetResponse(com.mailjet.client.MailjetResponse) MailjetRequest(com.mailjet.client.MailjetRequest)

Aggregations

MailjetClient (com.mailjet.client.MailjetClient)2 ClientOptions (com.mailjet.client.ClientOptions)1 MailjetRequest (com.mailjet.client.MailjetRequest)1 MailjetResponse (com.mailjet.client.MailjetResponse)1