use of com.aliyuncs.dm.model.v20151123.SingleSendMailRequest in project TranslateIt-api by zunpiau.
the class EmailService method sendEmail.
private void sendEmail(String mailTo, String subject, String content) {
SingleSendMailRequest request = new SingleSendMailRequest();
request.setAccountName(aliAccount);
request.setFromAlias("TranslateIt");
request.setAddressType(1);
request.setReplyToAddress(true);
request.setToAddress(mailTo);
request.setSubject(subject);
request.setHtmlBody(content);
try {
HttpResponse response = client.doAction(request, true, 2);
logger.debug("send email to [{}] status [{}]", mailTo, response.getStatus());
if (!response.isSuccess()) {
throw new EmailSendException();
}
} catch (ClientException e) {
logger.error(mailTo, e);
throw new EmailSendException();
}
}
Aggregations