com.amazonaws.services.simpleemail.model.Body.withText()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中com.amazonaws.services.simpleemail.model.Body.withText()方法的一些代码示例,展示了Body.withText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.withText()方法的具体详情如下:
包路径:com.amazonaws.services.simpleemail.model.Body
类名称:Body
方法名:withText

Body.withText介绍

[英]The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).
[中]以文本格式显示消息的内容。用于基于文本的电子邮件客户端,或高延迟网络(如移动设备)上的客户端。

代码示例

代码示例来源:origin: org.duracloud/notification-amazon

@Override
public void send(String subject, String body, String... recipients) {
  Body requestBody = new Body().withText(new Content(body));
  sendEmail(subject, requestBody, recipients);
}

代码示例来源: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()));

相关文章