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

x33g5p2x  于2022-01-20 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(252)

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

HtmlEmail.setHtmlMsg介绍

[英]Set the HTML content.
[中]设置HTML内容。

代码示例

代码示例来源:origin: jphp-group/jphp

@Signature
public PHtmlEmail setHtmlMessage(String value) throws EmailException {
  htmlEmail.setHtmlMsg(value);
  return this;
}

代码示例来源:origin: Activiti/Activiti

protected HtmlEmail createHtmlEmail(String text, String html) {
 HtmlEmail email = new HtmlEmail();
 try {
  email.setHtmlMsg(html);
  if (text != null) { // for email clients that don't support html
   email.setTextMsg(text);
  }
  return email;
 } catch (EmailException e) {
  throw new ActivitiException("Could not create HTML email", e);
 }
}

代码示例来源:origin: ninjaframework/ninja

/**
 * Creates a MultiPartEmail. Selects the correct implementation
 * regarding html (MultiPartEmail) and/or txt content or both.
 * 
 * Populates the mutlipart email accordingly with the txt / html content.
 */
@Override
public MultiPartEmail createMultiPartEmailWithContent(Mail mail) throws EmailException {
  MultiPartEmail multiPartEmail;
  // set if it is a txt or html mail:
  if (mail.getBodyHtml() == null || mail.getBodyHtml().equals("")) {
    multiPartEmail = new MultiPartEmail();
    multiPartEmail.setMsg(mail.getBodyText());
  } else if (mail.getBodyText() == null || mail.getBodyText().equals("")) {
    multiPartEmail = new HtmlEmail().setHtmlMsg(mail.getBodyHtml());
  } else {
    multiPartEmail =
        new HtmlEmail().setHtmlMsg(mail.getBodyHtml()).setTextMsg(mail.getBodyText());
  }
  // and return the nicely configured mail:
  return multiPartEmail;
}

代码示例来源:origin: Dreampie/Resty

/**
 * @param subject    主题
 * @param body       内容
 * @param attachment 附件
 * @param recipients 收件人
 */
public static HtmlEmail getHtmlEmail(String subject, String body, EmailAttachment attachment, String... recipients) {
 try {
  HtmlEmail htmlEmail = new HtmlEmail();
  configEmail(subject, htmlEmail, recipients);
  if (body != null)
   htmlEmail.setHtmlMsg(body);
  // set the alter native message
  htmlEmail.setTextMsg("Your email client does not support HTML messages");
  if (attachment != null)
   htmlEmail.attach(attachment);
  return htmlEmail;
 } catch (EmailException e) {
  throw new MailException("Unabled to send email", e);
 }
}

代码示例来源:origin: apache/kylin

email.setCharset("UTF-8");
if (isHtmlMsg) {
  ((HtmlEmail) email).setHtmlMsg(content);
} else {
  ((HtmlEmail) email).setTextMsg(content);

代码示例来源:origin: jooby-project/jooby

ifset("msg", p -> {
 if (email instanceof HtmlEmail) {
  ((HtmlEmail) email).setHtmlMsg(mail.getString(p));
 } else {
  email.setMsg(mail.getString(p));

代码示例来源:origin: apache/nifi

mm = new HtmlEmail();
if(!StringUtils.isEmpty(bodyText)){
  ((HtmlEmail)mm).setHtmlMsg(bodyText);

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

.append(HTML_MESSAGE_END);
setHtmlMsg(htmlMsgBuf.toString());

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

protected HtmlEmail createHtmlEmail(String text, String html) {
 HtmlEmail email = new HtmlEmail();
 try {
  email.setHtmlMsg(html);
  if (text != null) { // for email clients that don't support html
   email.setTextMsg(text);
  }
  return email;
 } catch (EmailException e) {
  throw LOG.emailCreationException("HTML", e);
 }
}

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

protected HtmlEmail createHtmlEmail(String text, String html) {
 HtmlEmail email = new HtmlEmail();
 try {
  email.setHtmlMsg(html);
  if (text != null) { // for email clients that don't support html
   email.setTextMsg(text);
  }
  return email;
 } catch (EmailException e) {
  throw LOG.emailCreationException("HTML", e);
 }
}

代码示例来源:origin: javahongxi/whatsmars

/**
 * content为html,此方法将会对html进行转义。
 * @param targetAddress
 * @param title
 * @param content
 * @throws Exception
 */
public void sendHtmlEmail(String targetAddress,String title,String content) throws Exception {
  HtmlEmail email = new HtmlEmail();
  email.setSubject(title);
  email.setHtmlMsg(content);
  email.addTo(targetAddress);
  sendEmail(email);
}

代码示例来源:origin: KylinOLAP/Kylin

email.setSubject(subject);
email.setCharset("UTF-8");
((HtmlEmail) email).setHtmlMsg(content);
email.send();
email.getMailSession();

代码示例来源:origin: stackoverflow.com

HtmlEmail email = new HtmlEmail();

email.setHostName(mailserver);
email.setAuthentication(username, password);
email.setSmtpPort(port);
email.setFrom(fromEmail);
email.addTo(to);
email.setSubject(subject);

email.setTextMsg(textBody);
email.setHtmlMsg(htmlBody);

email.setDebug(true);

email.send();

代码示例来源:origin: org.seasar.tuigwaa/tuigwaa-net

private void setMailContent(Email mail, String mailContent)
    throws EmailException {
  if (mail instanceof HtmlEmail) {
    ((HtmlEmail) mail).setHtmlMsg(mailContent);
  } else if (mail instanceof SimpleEmail) {
    // due to bug of SimpleEmail#setMsg, not using the value of charset
    String contentType = MimeMappings.CONTENTTYPE_TXT + "; charset="
        + defaultProperties.getProperty(MAIL_CHARSET);
    ((SimpleEmail) mail).setContent(mailContent, contentType);
  }
}

代码示例来源:origin: org.activiti/activiti-engine

protected HtmlEmail createHtmlEmail(String text, String html) {
 HtmlEmail email = new HtmlEmail();
 try {
  email.setHtmlMsg(html);
  if (text != null) { // for email clients that don't support html
   email.setTextMsg(text);
  }
  return email;
 } catch (EmailException e) {
  throw new ActivitiException("Could not create HTML email", e);
 }
}

代码示例来源:origin: org.camunda.bpm/camunda-engine

protected HtmlEmail createHtmlEmail(String text, String html) {
 HtmlEmail email = new HtmlEmail();
 try {
  email.setHtmlMsg(html);
  if (text != null) { // for email clients that don't support html
   email.setTextMsg(text);
  }
  return email;
 } catch (EmailException e) {
  throw LOG.emailCreationException("HTML", e);
 }
}

代码示例来源:origin: com.ning.billing/killbill-util

@Override
public void sendHTMLEmail(final List<String> to, final List<String> cc, final String subject, final String htmlBody) throws EmailApiException {
  final HtmlEmail email = new HtmlEmail();
  try {
    email.setHtmlMsg(htmlBody);
  } catch (EmailException e) {
    throw new EmailApiException(e, ErrorCode.EMAIL_SENDING_FAILED);
  }
  sendEmail(to, cc, subject, email);
}

代码示例来源:origin: org.flowable/flowable-engine

protected HtmlEmail createHtmlEmail(String text, String html) {
  HtmlEmail email = new HtmlEmail();
  try {
    email.setHtmlMsg(html);
    if (text != null) { // for email clients that don't support html
      email.setTextMsg(text);
    }
    return email;
  } catch (EmailException e) {
    throw new FlowableException("Could not create HTML email", e);
  }
}

代码示例来源:origin: org.flowable/flowable5-engine

protected HtmlEmail createHtmlEmail(String text, String html) {
  HtmlEmail email = new HtmlEmail();
  try {
    email.setHtmlMsg(html);
    if (text != null) { // for email clients that don't support html
      email.setTextMsg(text);
    }
    return email;
  } catch (EmailException e) {
    throw new ActivitiException("Could not create HTML email", e);
  }
}

代码示例来源:origin: com.bbossgroups.activiti/activiti-engine

protected HtmlEmail createHtmlEmail(String text, String html) {
 HtmlEmail email = new HtmlEmail();
 try {
  email.setHtmlMsg(html);
  if (text != null) { // for email clients that don't support html
   email.setTextMsg(text);
  }
  return email;
 } catch (EmailException e) {
  throw new ActivitiException("Could not create HTML email", e);
 }
}

相关文章