@Signature public void __construct() { htmlEmail = new HtmlEmail(); }
@Override public HtmlEmail get() { return factory.newEmail(new HtmlEmail()); }
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 email = new HtmlEmail(); email.setHostName(host); email.setStartTLSEnabled(starttlsEnabled);
mm = new HtmlEmail(); if(!StringUtils.isEmpty(bodyText)){ ((HtmlEmail)mm).setHtmlMsg(bodyText);
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 email = new HtmlEmail(); email.setHostName(host); if (username != null && username.trim().length() > 0) {
/** * Creates a new instance of {@link HtmlEmail}. * * @return the created instance */ public HtmlEmail createHtmlEmail() { return new HtmlEmail(); } }
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();
@Override public HtmlEmail get() { return factory.newEmail(new HtmlEmail()); }
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); } }
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); } }
@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); }
HtmlEmail htmlEmail = new HtmlEmail(); htmlEmail.setHostName("smtp.gmail.com"); htmlEmail.setSmtpPort(587); htmlEmail.setDebug(true); htmlEmail.setAuthenticator(new DefaultAuthenticator("userId", "password")); htmlEmail.setTLS(true); htmlEmail.addTo("recipient@gmail.com", "recipient"); htmlEmail.setFrom("sender@gmail.com", "sender"); htmlEmail.setSubject("Send HTML email with body content from URI"); htmlEmail.setHtmlMsg(responseBody); htmlEmail.send();
private HtmlEmail createDefaultHtmlEmail() throws EmailException { final HtmlEmail htmlEmail = new HtmlEmail(); htmlEmail.setHostName(this.strTestMailServer); htmlEmail.setSmtpPort(this.getMailServerPort()); htmlEmail.setFrom("a@b.com"); htmlEmail.addTo("c@d.com"); return htmlEmail; } }