当前位置: 首页>>代码示例>>Java>>正文


Java SendEmailRequest.setMessage方法代码示例

本文整理汇总了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;
}
 
开发者ID:oneops,项目名称:oneops,代码行数:32,代码来源:EmailService.java

示例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;
}
 
开发者ID:Erudika,项目名称:para,代码行数:26,代码来源:AWSEmailer.java

示例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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:SesProducer.java


注:本文中的com.amazonaws.services.simpleemail.model.SendEmailRequest.setMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。