本文整理了Java中org.apache.commons.mail.HtmlEmail.setTextMsg()
方法的一些代码示例,展示了HtmlEmail.setTextMsg()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HtmlEmail.setTextMsg()
方法的具体详情如下:
包路径:org.apache.commons.mail.HtmlEmail
类名称:HtmlEmail
方法名:setTextMsg
[英]Set the text content.
[中]设置文本内容。
代码示例来源:origin: jphp-group/jphp
@Signature
public PHtmlEmail setTextMessage(String value) throws EmailException {
htmlEmail.setTextMsg(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: 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
((HtmlEmail) email).setHtmlMsg(content);
} else {
((HtmlEmail) email).setTextMsg(content);
代码示例来源: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: camunda/camunda-bpm-platform
setTextMsg(msg);
代码示例来源: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: 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.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: 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);
}
}
代码示例来源:origin: pierre/meteo
private void createAndSendAlertEmail(String body)
{
try {
log.info(String.format("Sending alert email to [%s]: %s", config.getRecipients(), body));
HtmlEmail email = new HtmlEmail();
email.setTextMsg(body);
email.setFrom("esper-is-awesome@example.com");
email.setTo(Arrays.asList(new InternetAddress(config.getRecipients())));
email.setHostName(config.getHost());
email.setSmtpPort(config.getPort());
email.send();
}
catch (Exception ex) {
log.warn("Could not create or send email", ex);
}
}
}
代码示例来源:origin: com.bbossgroups.pdp/pdp-cms
public void sendHtmlEmail(String toEmail, String toName, String subject,
String htmlMsg) throws Exception {
try {
HtmlEmail email = new HtmlEmail();
this.setEmail(email, toEmail, toName, subject, "HtmlEmail", null,
null);
email.setHtmlMsg(htmlMsg);
email
.setTextMsg("Your email client does not support HTML messages");
email.send();
} catch (EmailException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
}
代码示例来源:origin: com.bbossgroups.pdp/pdp-cms
public void sendHtmlEmails(Map toEmails, String subject, String htmlMsg)
throws Exception {
try {
HtmlEmail email = new HtmlEmail();
this.setEmail(email, toEmails, subject, "HtmlEmail");
email.setHtmlMsg(htmlMsg);
email
.setTextMsg("Your email client does not support HTML messages");
email.send();
} catch (EmailException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
}
代码示例来源:origin: ixrjog/opsCloud
public HtmlEmail buildHtmlEmail(String emailAddress, String displayName) throws Exception {
HashMap<String, String> configMap = acqConifMap();
String hostName = configMap.get(EmailItemEnum.EMAIL_HOST.getItemKey());
String userName = configMap.get(EmailItemEnum.EMAIL_USERNAME.getItemKey());
String userPwd = configMap.get(EmailItemEnum.EMAIL_PWD.getItemKey());
// Create the email message
HtmlEmail email = new HtmlEmail();
email.setAuthentication(userName, userPwd);
email.setHostName(hostName);
email.addTo(emailAddress, displayName);
email.setFrom("msg@51xianqu.net", "CMDB");
email.setSubject("工单消息~");
email.setCharset("UTF-8");
// set the alternative message
email.setTextMsg("Your email client does not support HTML messages");
return email;
}
代码示例来源:origin: com.github.robozonky/robozonky-notifications
@Override
public void send(final SessionInfo sessionInfo, final String subject,
final String message, final String fallbackMessage) throws Exception {
final HtmlEmail email = createNewEmail(sessionInfo);
email.setSubject(subject);
email.setHtmlMsg(message);
email.setTextMsg(fallbackMessage);
LOGGER.debug("Will send '{}' from {} to {} through {}:{} as {}.", email.getSubject(),
email.getFromAddress(), email.getToAddresses(), email.getHostName(), email.getSmtpPort(),
getSmtpUsername());
email.send();
}
}
代码示例来源:origin: RoboZonky/robozonky
@Override
public void send(final SessionInfo sessionInfo, final String subject,
final String message, final String fallbackMessage) throws Exception {
final HtmlEmail email = createNewEmail(sessionInfo);
email.setSubject(subject);
email.setHtmlMsg(message);
email.setTextMsg(fallbackMessage);
LOGGER.debug("Will send '{}' from {} to {} through {}:{} as {}.", email.getSubject(),
email.getFromAddress(), email.getToAddresses(), email.getHostName(), email.getSmtpPort(),
getSmtpUsername());
email.send();
}
}
内容来源于网络,如有侵权,请联系作者删除!