/** * @param subject 主题 * @param body 内容 * @param recipients 收件人 */ public static void sendText(String subject, String body, String... recipients) { try { SimpleEmail simpleEmail = getSimpleEmail(subject, body, recipients); simpleEmail.send(); logger.info("send email to {}", Joiner.on(",").useForNull("null").join(recipients)); } catch (EmailException e) { throw new MailException("Unabled to send email", e); } }
email.send();
SimpleEmail email = new SimpleEmail(); email.setHostName("mail.myserver.com"); email.addTo("jdoe@somewhere.org", "John Doe"); email.setFrom("me@apache.org", "Me"); email.setSubject("Test message"); email.setMsg("This is a simple test of commons-email"); email.send();
public void sendSimpleEmail(String toEmail, String toName, String subject, String msg, String senderEmail, String senderName) throws Exception { try { SimpleEmail email = new SimpleEmail(); this.setEmail(email, toEmail, toName, subject, msg, senderEmail, senderName); email.send(); } catch (EmailException e) { e.printStackTrace(); throw e; } }
public void sendSimpleEmail(String toEmail, String toName, String subject, String msg) throws Exception { try { SimpleEmail email = new SimpleEmail(); this.setEmail(email, toEmail, toName, subject, msg, null, null); email.send(); } catch (EmailException e) { e.printStackTrace(); throw e; } }
public void sendSimpleEmails(Map toEmails, String subject, String msg) throws Exception { try { SimpleEmail email = new SimpleEmail(); this.setEmail(email, toEmails, subject, msg); email.send(); } catch (EmailException e) { e.printStackTrace(); throw e; } }
mail.setFrom(statusMailSender); mail.send(); log.info("Send status ({}) mail to {}.", new String[]
mail.setFrom(statusMailSender); mail.send(); log.info("Send status ({}) mail to {}.", new String[]
private void sendTextMail(String fromEmail, String fromPasswd,String fromName, String host,List<String> toEmailList,MailMsg mailMsg){ SimpleEmail email = new SimpleEmail(); try { initEmail(email, fromEmail, fromPasswd,fromName, host, toEmailList, mailMsg); email.setMsg(mailMsg.getContent()); email.send(); } catch (EmailException e) { e.printStackTrace(); } }
SimpleEmail email = new SimpleEmail(); email.setHostName("mail.myserver.com"); email.addTo("jdoe@somewhere.org", "John Doe"); email.setFrom("me@apache.org", "Me"); email.setSubject("Test message"); email.setMsg("This is a simple test of commons-email"); email.send();
public Document processDocument(Document doc) throws DocumentProcessorException { SimpleEmail email = new SimpleEmail(); email.setHostName(hostName); try { email.addTo(to); email.setFrom(from); email.setSubject("Document"); email.setMsg(doc.getPrintRepresentation()); email.send(); } catch (EmailException e) { throw new DocumentProcessorException(e); } return doc; }
public void sendSimpleEmail(String toEmail, String toName, String subject, String msg, String senderEmail, String senderName, String serverName) throws Exception { SimpleEmail email = new SimpleEmail(); ConfigManager cm = ConfigManager.getInstance(); String hostName = serverName==null ? cm .getConfigValue("cms.smtpServer","mail.sany.com"):serverName; String senderE = senderEmail == null ? cm .getConfigValue("cms.mail_sender") : senderEmail; String senderN = senderName == null ? cm.getConfigValue( "cms.mail_senderName", "sany") : senderName; email.setHostName(hostName); email.addTo(toEmail, toName); email.setFrom(senderE, senderN); email.setSubject(subject); email.setContent(msg,"text/plain; charset=utf-8"); email.send(); // TODO Auto-generated method stub }
email.setMsg("This is a simple test of commons-email"); email.setDebug(true); email.send();
messageID = super.send(); } catch (EmailException e) {
textEmail.send(); } catch (EmailException ex) { record.addError(ProcessError.UNKNOWN_ERROR.getName(), "Unable to send email: " + ex.getMessage());
messageID = super.send(); } catch (EmailException e) {