本文整理了Java中org.apache.commons.mail.HtmlEmail.setCharset()
方法的一些代码示例,展示了HtmlEmail.setCharset()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HtmlEmail.setCharset()
方法的具体详情如下:
包路径:org.apache.commons.mail.HtmlEmail
类名称:HtmlEmail
方法名:setCharset
暂无
代码示例来源:origin: jphp-group/jphp
@Signature
public PHtmlEmail setCharset(String charset) {
htmlEmail.setCharset(charset);
return this;
}
代码示例来源:origin: mycontroller-org/mycontroller
public static void sendSimpleEmail(String emails, String subject, String message, boolean initializeEmail)
throws EmailException {
if (initializeEmail) {
initializeEmail(AppProperties.getInstance().getEmailSettings());
}
email.setCharset("UTF-8");
email.setSubject(subject);
email.setHtmlMsg(message);
email.addTo(emails.split(","));
String sendReturn = email.send();
_logger.debug("Send Status:[{}]", sendReturn);
_logger.debug("EmailSettings successfully sent to [{}], Message:[{}]", emails, message);
}
代码示例来源:origin: org.mycontroller.standalone/mycontroller-core
public static void sendSimpleEmail(String emails, String subject, String message, boolean initializeEmail)
throws EmailException {
if (initializeEmail) {
initializeEmail(AppProperties.getInstance().getEmailSettings());
}
email.setCharset("UTF-8");
email.setSubject(subject);
email.setHtmlMsg(message);
email.addTo(emails.split(","));
String sendReturn = email.send();
_logger.debug("Send Status:[{}]", sendReturn);
_logger.debug("EmailSettings successfully sent to [{}], Message:[{}]", emails, message);
}
代码示例来源:origin: Junety-C/alarm
private boolean send(String title, String content, List<String> receivers) {
try {
HtmlEmail email = new HtmlEmail();
email.setAuthentication(Configuration.MAIL_SENDER_USERNAME, Configuration.MAIL_SENDER_PASSWORD);
email.setHostName(Configuration.MAIL_SENDER_SMTP_HOST);
email.setSmtpPort(Configuration.MAIL_SENDER_SMTP_PORT);
email.setFrom(Configuration.MAIL_SENDER_USERNAME, Configuration.MAIL_SENDER_NAME);
email.setSubject(title);
email.setHtmlMsg(content);
email.addTo(receivers.stream().toArray(String[]::new));
email.setCharset("UTF-8");
email.setSSLOnConnect(false);
email.send();
logger.info("send mail to {} success", JSON.toJSONString(receivers));
return true;
} catch (Exception e) {
logger.error("send mail to {} fail, caused by", JSON.toJSONString(receivers), e);
return false;
}
}
}
代码示例来源:origin: jiang111/ReSend-SMS
email.setSmtpPort(ssLPort);
email.setSSL(true);
email.setCharset("utf8");
email.addTo(sendTo);
email.setFrom(sendFrom);
代码示例来源: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: RoboZonky/robozonky
private HtmlEmail createNewEmail(final SessionInfo session) throws EmailException {
final HtmlEmail email = new HtmlEmail();
email.setCharset(Defaults.CHARSET.displayName()); // otherwise the e-mail contents are mangled
email.setHostName(getSmtpHostname());
email.setSmtpPort(getSmtpPort());
email.setStartTLSRequired(isStartTlsRequired());
email.setSSLOnConnect(isSslOnConnectRequired());
if (isAuthenticationRequired()) {
final String username = getSmtpUsername();
LOGGER.debug("Will contact SMTP server as '{}'.", username);
email.setAuthentication(getSmtpUsername(), getSmtpPassword());
} else {
LOGGER.debug("Will contact SMTP server anonymously.");
}
email.setFrom(getSender(), session.getName());
email.addTo(getRecipient());
return email;
}
代码示例来源:origin: com.github.robozonky/robozonky-notifications
private HtmlEmail createNewEmail(final SessionInfo session) throws EmailException {
final HtmlEmail email = new HtmlEmail();
email.setCharset(Defaults.CHARSET.displayName()); // otherwise the e-mail contents are mangled
email.setHostName(getSmtpHostname());
email.setSmtpPort(getSmtpPort());
email.setStartTLSRequired(isStartTlsRequired());
email.setSSLOnConnect(isSslOnConnectRequired());
if (isAuthenticationRequired()) {
final String username = getSmtpUsername();
LOGGER.debug("Will contact SMTP server as '{}'.", username);
email.setAuthentication(getSmtpUsername(), getSmtpPassword());
} else {
LOGGER.debug("Will contact SMTP server anonymously.");
}
email.setFrom(getSender(), session.getName());
email.addTo(getRecipient());
return email;
}
代码示例来源:origin: theonedev/onedev
if (smtpUser != null)
email.setAuthentication(smtpUser, mailSetting.getSmtpPassword());
email.setCharset(CharEncoding.UTF_8);
代码示例来源:origin: Rekoe/rk_svnadmin
public boolean send(String to, String subject, String templateFile, Map<String, Object> root) {
try {
HtmlEmail email = ioc.get(HtmlEmail.class);
email.setCharset("UTF-8");
email.setSubject(subject);
email.setHtmlMsg(processTemplateIntoString(templateFile, root));
email.addTo(to);
String res = email.send();
if (log.isDebugEnabled()) {
log.debug(res);
}
return true;
} catch (Exception e) {
log.error("send email fail", e);
return false;
}
}
内容来源于网络,如有侵权,请联系作者删除!