@Signature public PHtmlEmail setTextMessage(String value) throws EmailException { htmlEmail.setTextMsg(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); } }
/** * @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); } }
((HtmlEmail) email).setHtmlMsg(content); } else { ((HtmlEmail) email).setTextMsg(content);
/** * 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; }
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); } }
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();
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); } }
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); } }
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); } } }
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; } }
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; } }
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; }
@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(); } }
@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(); } }