@Signature public PHtmlEmail setHtmlMessage(String value) throws EmailException { htmlEmail.setHtmlMsg(value); return this; }
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); } }
/** * 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; }
/** * @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); } }
email.setCharset("UTF-8"); if (isHtmlMsg) { ((HtmlEmail) email).setHtmlMsg(content); } else { ((HtmlEmail) email).setTextMsg(content);
ifset("msg", p -> { if (email instanceof HtmlEmail) { ((HtmlEmail) email).setHtmlMsg(mail.getString(p)); } else { email.setMsg(mail.getString(p));
mm = new HtmlEmail(); if(!StringUtils.isEmpty(bodyText)){ ((HtmlEmail)mm).setHtmlMsg(bodyText);
.append(HTML_MESSAGE_END); setHtmlMsg(htmlMsgBuf.toString());
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); } }
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); } }
/** * 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); }
email.setSubject(subject); email.setCharset("UTF-8"); ((HtmlEmail) email).setHtmlMsg(content); email.send(); email.getMailSession();
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();
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); } }
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); } }
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); } }
@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); }
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); } }
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); } }
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); } }