use of com.sendgrid.SendGrid.Response in project mxisd by kamax-io.
the class EmailSendGridNotificationHandler method send.
private void send(String recipient, Email email) {
if (StringUtils.isBlank(cfg.getIdentity().getFrom())) {
throw new FeatureNotAvailable("3PID Email identity: sender address is empty - " + "You must set a value for notifications to work");
}
try {
email.addTo(recipient);
email.setFrom(cfg.getIdentity().getFrom());
email.setFromName(cfg.getIdentity().getName());
Response response = sendgrid.send(email);
if (response.getStatus()) {
log.info("Successfully sent email to {} using SendGrid", recipient);
} else {
throw new RuntimeException("Error sending via SendGrid to " + recipient + ": " + response.getMessage());
}
} catch (SendGridException e) {
throw new RuntimeException("Unable to send e-mail invite via SendGrid to " + recipient, e);
}
}
use of com.sendgrid.SendGrid.Response in project mxisd by kamax-io.
the class EmailSendGridNotificationHandler method send.
private void send(String recipient, Email email) {
if (StringUtils.isBlank(cfg.getIdentity().getFrom())) {
throw new FeatureNotAvailable("3PID Email identity: sender address is empty - " + "You must set a value for notifications to work");
}
try {
email.addTo(recipient);
email.setFrom(cfg.getIdentity().getFrom());
email.setFromName(cfg.getIdentity().getName());
Response response = sendgrid.send(email);
if (response.getStatus()) {
log.info("Successfully sent email to {} using SendGrid", recipient);
} else {
throw new RuntimeException("Error sending via SendGrid to " + recipient + ": " + response.getMessage());
}
} catch (SendGridException e) {
throw new RuntimeException("Unable to send e-mail invite via SendGrid to " + recipient, e);
}
}
Aggregations