本文整理汇总了Java中com.amazonaws.services.simpleemail.model.SendEmailRequest.setMessage方法的典型用法代码示例。如果您正苦于以下问题:Java SendEmailRequest.setMessage方法的具体用法?Java SendEmailRequest.setMessage怎么用?Java SendEmailRequest.setMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.simpleemail.model.SendEmailRequest
的用法示例。
在下文中一共展示了SendEmailRequest.setMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendEmail
import com.amazonaws.services.simpleemail.model.SendEmailRequest; //导入方法依赖的package包/类
/**
* Send email.
*
* @param eMsg the e msg
* @return true, if successful
*/
public boolean sendEmail(EmailMessage eMsg) {
SendEmailRequest request = new SendEmailRequest().withSource(eMsg.getFromAddress());
Destination dest = new Destination().withToAddresses(eMsg.getToAddresses());
dest.setCcAddresses(eMsg.getToCcAddresses());
request.setDestination(dest);
Content subjContent = new Content().withData(eMsg.getSubject());
Message msg = new Message().withSubject(subjContent);
Content textContent = new Content().withData(eMsg.getTxtMessage());
Body body = new Body().withText(textContent);
if (eMsg.getHtmlMessage() != null) {
Content htmlContent = new Content().withData(eMsg.getHtmlMessage());
body.setHtml(htmlContent);
}
msg.setBody(body);
request.setMessage(msg);
try {
emailClient.sendEmail(request);
logger.debug(msg);
} catch (AmazonClientException e) {
logger.error(e.getMessage());
return false;
}
return true;
}
示例2: sendEmail
import com.amazonaws.services.simpleemail.model.SendEmailRequest; //导入方法依赖的package包/类
@Override
public boolean sendEmail(List<String> emails, String subject, String body) {
if (emails != null && !emails.isEmpty() && !StringUtils.isBlank(body)) {
final SendEmailRequest request = new SendEmailRequest().withSource(Config.SUPPORT_EMAIL);
Destination dest = new Destination().withToAddresses(emails);
request.setDestination(dest);
Content subjContent = new Content().withData(subject);
Message msg = new Message().withSubject(subjContent);
// Include a body in both text and HTML formats
Content textContent = new Content().withData(body).withCharset(Config.DEFAULT_ENCODING);
msg.setBody(new Body().withHtml(textContent));
request.setMessage(msg);
Para.asyncExecute(new Runnable() {
public void run() {
sesclient.sendEmail(request);
}
});
return true;
}
return false;
}
示例3: createMailRequest
import com.amazonaws.services.simpleemail.model.SendEmailRequest; //导入方法依赖的package包/类
private SendEmailRequest createMailRequest(Exchange exchange) {
SendEmailRequest request = new SendEmailRequest();
request.setSource(determineFrom(exchange));
request.setDestination(determineTo(exchange));
request.setReturnPath(determineReturnPath(exchange));
request.setReplyToAddresses(determineReplyToAddresses(exchange));
request.setMessage(createMessage(exchange));
return request;
}