Search in sources :

Example 6 with MailjetRequest

use of com.mailjet.client.MailjetRequest 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

MailjetRequest (com.mailjet.client.MailjetRequest)6 JSONArray (org.json.JSONArray)5 JSONObject (org.json.JSONObject)5 MailjetResponse (com.mailjet.client.MailjetResponse)4 MailjetException (com.mailjet.client.errors.MailjetException)3 MailjetSocketTimeoutException (com.mailjet.client.errors.MailjetSocketTimeoutException)2 ServletException (javax.servlet.ServletException)2 MailjetClient (com.mailjet.client.MailjetClient)1 Test (org.testng.annotations.Test)1 EmailWrapper (teammates.common.util.EmailWrapper)1 MailjetService (teammates.logic.core.MailjetService)1