org.apache.commons.mail.Email.setContent()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(150)

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

Email.setContent介绍

[英]Set the content and contentType.
[中]设置内容和内容类型。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Initialize the multipart email.
 * @since 1.0
 */
protected void init()
{
  if (initialized)
  {
    throw new IllegalStateException("Already initialized");
  }
  container = createMimeMultipart();
  super.setContent(container);
  initialized = true;
}

代码示例来源:origin: org.apache.commons/commons-email

/**
 * Initialize the multipart email.
 * @since 1.0
 */
protected void init()
{
  if (initialized)
  {
    throw new IllegalStateException("Already initialized");
  }
  container = createMimeMultipart();
  super.setContent(container);
  initialized = true;
}

代码示例来源:origin: com.bbossgroups.pdp/pdp-cms

private void setEmail(Email email, Map toEmails, String subject, String msg)
    throws Exception {
  // 配置文件中获取邮件服务器
  ConfigManager cm = ConfigManager.getInstance();
  String hostName = cm.getConfigValue("cms.smtpServer","mail.sany.com");
  String sender = cm.getConfigValue("cms.mail_sender");
  String senderName = cm.getConfigValue("cms.mail_senderName", "sany");
  email.setHostName(hostName);
  Iterator it = toEmails.keySet().iterator();
  while (it.hasNext()) {
    String key = (String) it.next();
    email.addTo((String) toEmails.get(key), key);
  }
  email.setFrom(sender, senderName);
  email.setSubject(subject);
  email.setContent(msg,"text/plain; charset=utf-8");
  //email.setMsg(msg);
}

代码示例来源:origin: com.bbossgroups.pdp/pdp-cms

private void setEmail(Email email, String toEmail, String toName,
    String subject, String msg, String sendEmail, String sendName)
    throws Exception {
      ConfigManager cm = ConfigManager.getInstance();
      String hostName = cm.getConfigValue("cms.smtpServer","mail.sany.com");
      String sender = sendEmail == null ? cm.getConfigValue("cms.mail_sender") : sendEmail;
      String senderName = sendName == null ? cm.getConfigValue("cms.mail_senderName", "sany") : sendName;
      email.setHostName(hostName);
      email.addTo(toEmail, toName);
      email.setFrom(sender, senderName);
      email.setSubject(subject);
      email.setContent(msg,"text/plain; charset=utf-8");
      //email.setMsg(msg);
    }

相关文章

微信公众号

最新文章

更多