本文整理了Java中com.amazonaws.services.simpleemail.model.Body.withHtml()
方法的一些代码示例,展示了Body.withHtml()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.withHtml()
方法的具体详情如下:
包路径:com.amazonaws.services.simpleemail.model.Body
类名称:Body
方法名:withHtml
[英]The content of the message, in HTML format. Use this for email clients that can process HTML. You can include clickable links, formatted text, and much more in an HTML message.
[中]以HTML格式显示消息的内容。用于可以处理HTML的电子邮件客户端。您可以在HTML消息中包含可单击链接、格式化文本以及更多内容。
代码示例来源:origin: org.duracloud/notification-amazon
@Override
public void sendAsHtml(String subject, String body, String... recipients) {
Body requestBody = new Body().withHtml(new Content(body));
sendEmail(subject, requestBody, recipients);
}
代码示例来源:origin: micronaut-projects/micronaut-examples
private Body bodyOfEmail(Email email) {
if (email.getHtmlBody() != null) {
Content htmlBody = new Content().withData(email.getHtmlBody());
return new Body().withHtml(htmlBody);
}
if (email.getTextBody() != null) {
Content textBody = new Content().withData(email.getTextBody());
return new Body().withHtml(textBody);
}
return new Body();
}
代码示例来源:origin: com.erudika/para-server
@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;
}
}
代码示例来源:origin: com.erudika/para
@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);
Utils.asyncExecute(new Runnable() {
public void run() {
sesclient.sendEmail(request);
}
});
return true;
}
return false;
}
}
代码示例来源:origin: Erudika/para
@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;
}
}
代码示例来源:origin: dmart28/gcplot
@Override
void makeSend(String to, String subject, String msg) {
String accessKey = config.readString(ConfigProperty.SES_ACCESS_KEY);
String secretKey = config.readString(ConfigProperty.SES_SECRET_KEY);
if (!Strings.isNullOrEmpty(accessKey)) {
Destination destination = new Destination().withToAddresses(to);
Content subj = new Content().withData(subject);
Content textBody = new Content().withData(msg);
Body body = new Body().withHtml(textBody);
Message message = new Message().withSubject(subj).withBody(body);
SendEmailRequest req = new SendEmailRequest().withSource(config.readString(ConfigProperty.EMAIL_DEFAULT_FROM_NAME)
+ " <" + config.readString(ConfigProperty.EMAIL_DEFAULT_FROM) + ">")
.withDestination(destination).withMessage(message);
AmazonSimpleEmailService client = AmazonSimpleEmailServiceClientBuilder.standard()
.withRegion(config.readString(ConfigProperty.SES_REGION))
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)))
.build();
try {
client.sendEmail(req);
} finally {
client.shutdown();
}
} else {
throw new IllegalStateException("SES Mail provider wasn't configured well.");
}
}
代码示例来源:origin: kodokojo/kodokojo
private void sendSimpleMail(List<String> to, List<String> cc, List<String> ci, String object, String content, boolean htmlContent) {
Destination destination = new Destination().withToAddresses(to).withBccAddresses(ci).withCcAddresses(cc);
Content subject = new Content().withData(object);
Content bodyContent = new Content().withData(content);
Body body;
if (htmlContent) {
body = new Body().withHtml(bodyContent);
} else {
body = new Body().withText(bodyContent);
}
Message message = new Message().withSubject(subject).withBody(body);
SendEmailRequest request = new SendEmailRequest().withSource(from).withDestination(destination).withMessage(message);
try {
AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient();
client.setRegion(region);
client.sendEmail(request);
} catch (Exception e) {
LOGGER.error("Unable to send email to {} with subject '{}'", StringUtils.join(to, ","), subject, e);
}
}
代码示例来源:origin: com.cosmicpush/push-server-plugin-ses
body.withText(new Content().withCharset("UTF-8").withData("-no message-"));
} else {
body.withHtml(new Content().withCharset("UTF-8").withData(push.getHtmlContent()));
内容来源于网络,如有侵权,请联系作者删除!