List of usage examples for org.apache.commons.mail Email setSubject
public Email setSubject(final String aSubject)
From source file:ch.sbb.releasetrain.utils.emails.SMTPUtilImpl.java
@Override public void send(String absender, String empfaenger, String betreff, String text) { try {/*w w w . j a va2 s. c o m*/ final Email email = new SimpleEmail(); email.setHostName(mailhost); email.setSmtpPort(mailport); email.setFrom(absender); email.setSubject(betreff); email.setMsg(text); email.addTo(empfaenger); email.send(); log.info("mail sent to: " + empfaenger); } catch (final EmailException e) { log.error(e.getMessage(), e); } }
From source file:ch.unibas.fittingwizard.application.tools.Notifications.java
private void sendMailTesting() { try {//from w w w .j a v a 2s . c om Email email = new SimpleEmail(); email.setMailSession(Session.getDefaultInstance(props)); email.setSubject("Test mail"); email.setMsg("This is a test mail for checking parameters from config file"); email.setFrom(getSender().trim()); email.addTo(getRecipient().trim()); email.send(); } catch (EmailException e) { throw new RuntimeException("Could not send notification.", e); } }
From source file:ch.unibas.fittingwizard.application.tools.Notifications.java
private void sendMailGaussian(boolean isLogValid) { try {//from ww w .j a v a 2s . c o m Email email = new SimpleEmail(); email.setMailSession(Session.getDefaultInstance(props)); email.setSubject("Gaussian calculation finished"); email.setMsg("Gaussian calculation finished. Log file validation returned: " + isLogValid); email.setFrom(getSender().trim()); email.addTo(getRecipient().trim()); email.send(); } catch (EmailException e) { throw new RuntimeException("Could not send notification.", e); } }
From source file:ch.unibas.fittingwizard.application.tools.Notifications.java
private void sendErrorLogByMail() { try {/* ww w. j a v a2 s.c o m*/ Email email = new SimpleEmail(); email.setMailSession(Session.getDefaultInstance(props)); email.setSubject("Log of FW session"); email.setMsg(new String(Files.readAllBytes(Paths.get("fw-log.txt")))); email.setFrom(getSender().trim()); email.addTo(getRecipient().trim()); email.send(); } catch (IOException | EmailException e) { throw new RuntimeException("Could not send notification.", e); } }
From source file:br.com.recursive.biblioteca.servicos.EmailService.java
public void sendHtmlEmail(Pessoa pessoa) throws EmailException { Email email = new HtmlEmail(); email.setAuthenticator(new DefaultAuthenticator("claupwd@gmail.com", "@claupwd2014")); email.setHostName("smtp.gmail.com"); email.setFrom("claupwd@gmail.com"); email.setSubject("SIB Online - Recuperao de Senha"); email.setMsg(createMessage(pessoa)); email.addTo(pessoa.getContato().getEmail()); email.setSSL(true);/*from w w w.jav a 2s. c om*/ //Se true, exibe na saida todo o processo do envio do email email.setDebug(true); email.send(); }
From source file:com.qwazr.connectors.EmailConnector.java
private void generic_params(Email email, Map<String, Object> params) throws EmailException { Object subject = params.get("subject"); if (subject != null) email.setSubject(subject.toString()); Object from_email = params.get("from_email"); if (from_email != null) { Object from_name = params.get("from_name"); if (from_name != null) email.setFrom(from_email.toString(), from_name.toString()); else// ww w.ja v a 2 s .com email.setFrom(from_email.toString()); } }
From source file:com.patrolpro.beans.ContactUsBean.java
public String sendEmail() { try {/* w w w . j av a 2 s . c om*/ StringBuilder emailMessage = new StringBuilder(); emailMessage.append("From: " + this.name + "\r\n"); emailMessage.append("Email: " + this.email + "\r\n"); emailMessage.append("Phone: " + this.phone + "\r\n"); emailMessage.append(message); Email htmlEmail = new SimpleEmail(); htmlEmail.setMsg(message); htmlEmail.setFrom("contact@patrolpro.com"); htmlEmail.setSubject("Contact Us Email"); htmlEmail.addTo("rharris@ainteractivesolution.com"); htmlEmail.addCc("ijuneau@ainteractivesolution.com"); htmlEmail.addCc("jc@champ.net"); htmlEmail.setMsg(emailMessage.toString()); htmlEmail.setAuthenticator(new MailAuthenticator("schedfox", "Sch3dF0x4m3")); htmlEmail.setHostName("mail2.champ.net"); htmlEmail.setSmtpPort(587); htmlEmail.send(); return "sentContactEmail"; } catch (Exception exe) { } return "invalid"; }
From source file:com.qwazr.library.email.EmailConnector.java
private void generic_params(final Email email, final Map<String, Object> params) throws EmailException { Object subject = params.get(PARAM_SUBJECT); if (subject != null) email.setSubject(subject.toString()); Object from_email = params.get(PARAM_FROM_EMAIL); if (from_email != null) { Object from_name = params.get(PARAM_FROM_NAME); if (from_name != null) email.setFrom(from_email.toString(), from_name.toString()); else//w w w .j av a 2 s . c om email.setFrom(from_email.toString()); } }
From source file:cl.alma.scrw.bpmn.tasks.MailActivityBehavior.java
protected void setSubject(Email email, String subject) { email.setSubject(subject != null ? subject : ""); }
From source file:ch.sdi.core.impl.mail.MailCreator.java
/** * Creates a new simple mail class and fills the subject and the body for the given person * @param aPerson the person for whom the mail is addressed * * @return a mail instance/* w w w. j av a2 s .co m*/ * @throws SdiException on any problem */ public Email createMailFor(Person<?> aPerson) throws SdiException { Email email = new SimpleEmail(); try { email.addTo(aPerson.getEMail()); String subject = myMailTextResolver.getResolvedSubject(aPerson); myLog.debug("resolved subject: " + subject); email.setSubject(subject); String body = myMailTextResolver.getResolvedBody(aPerson); myLog.debug("resolved body: " + body); email.setMsg(body); } catch (EmailException t) { throw new SdiException("Problems setting up mail for " + aPerson.getEMail(), t, SdiException.EXIT_CODE_MAIL_ERROR); } return email; }