List of usage examples for org.apache.commons.mail Email setMsg
public abstract Email setMsg(String msg) throws EmailException;
From source file:com.aprodher.actions.util.EmailUtils.java
public static void enviaEmail(Mensaje mensagem) throws EmailException { Email email = new SimpleEmail(); email = conectaEmail();/*from w ww . j a v a 2s . co m*/ email.setSubject(mensagem.getTitulo()); email.setMsg(mensagem.getMensagem()); email.addTo(mensagem.getDestino()); String resposta = email.send(); JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("emailenviado") + resposta); }
From source file:gsn.utils.services.EmailService.java
/** * This method cover most of the cases of sending a simple text email. If the email to be sent has to be configured * in a way which is not possible whith the parameters provided (such as html email, or email with attachement, ..), * please use the {@link #sendCustomEmail(org.apache.commons.mail.Email)} method and refer the API * {@see http://commons.apache.org/email/}. * * @param to A set of destination email address of the email. Must contain at least one address. * @param object The subject of the email. * @param message The msg of the email./*from w w w . jav a 2 s .c om*/ * @return true if the email has been sent successfully, false otherwise. */ public static boolean sendEmail(ArrayList<String> to, String object, String message) { Email email = new SimpleEmail(); try { email.setSubject(object); email.setMsg(message); if (to != null) for (String _to : to) email.addTo(_to); sendCustomEmail(email); return true; } catch (EmailException e) { logger.warn( "Please, make sure that the SMTP server configuration is correct in the file: " + SMTP_FILE); logger.error(e.getMessage(), e); return false; } }
From source file:de.alpharogroup.message.system.service.CommonsEmailSendService.java
public static void sendEmail(final EmailConfiguration config, InfoMessageModel model) throws EmailException { // TODO make class for email config... Email email = new SimpleEmail(); email.setHostName(config.getHostName()); email.setSmtpPort(config.getSmtpPort()); email.setFrom(model.getApplicationSenderAddress()); email.setSubject(model.getMessageContentModel().getSubject()); email.setMsg(model.getMessageContentModel().getContent()); email.addTo(model.getRecipientEmailContact()); email.send();/*from w w w . j av a 2s. c o m*/ }
From source file:io.jhonesdeveloper.swing.util.EmailUtil.java
public static void sendBasicText(String hostName, String username, String password, String from, String subject, String msg, String[] to) throws EmailException { Email email = new SimpleEmail(); email.setHostName(hostName);/*from www.j a v a 2 s. c om*/ email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator(username, password)); email.setSSLOnConnect(true); email.setFrom(from); email.setSubject(subject); email.setMsg(msg); email.addTo(to); email.send(); }
From source file:br.fgv.util.EmailSender.java
public static void enviarEmail(String body, String subject) throws EmailException { StringBuffer sb = new StringBuffer(""); sb.append(body);/*w w w . ja va 2s . c om*/ Email email = new SimpleEmail(); email.setHostName("smtp.gmail.com"); email.setDebug(true); email.setSSLOnConnect(true); email.addTo("wesley.seidel@gmail.com"); email.setAuthentication("wseidel.fgv", "batavinhofgv"); email.setFrom("wseidel.fgv@gmail.com"); email.setSubject(subject); email.setMsg(sb.toString()); email.send(); }
From source file:com.reizes.shiva.net.mail.EmailSender.java
public static String sendMail(String host, int port, String from, String to, String subject, String text) throws IOException, EmailException { if (to != null && host != null) { String[] emailTo = StringUtils.split(to, ';'); Email email = new SimpleEmail(); email.setHostName(host);//w w w . j a va 2 s. co m email.setSmtpPort(port); email.setFrom(from); for (String recv : emailTo) { email.addTo(recv); } email.setSubject(subject); email.setMsg(text); return email.send(); } return null; }
From source file:at.tugraz.kmi.medokyservice.ErrorLogNotifier.java
public static void errorEmail(String msg) { Email email = new SimpleEmail(); email.setHostName("something.com"); email.setSmtpPort(465);/*from ww w . ja v a2 s . c o m*/ DefaultAuthenticator auth = new DefaultAuthenticator("username", "pwd"); email.setAuthenticator(auth); email.setSSLOnConnect(true); try { email.setFrom("email address"); email.setSubject("[MEDoKyService] Error"); email.setMsg(msg); email.addTo("yourmail.com"); email.send(); } catch (EmailException e) { e.printStackTrace(); } }
From source file:connection.EmailSending.java
public static void sendTextEmail(String subject, String content, String recipientEmail) { Email email = new SimpleEmail(); email.setHostName(MailInfor.HOST_NAME); email.setSmtpPort(465);//from www . ja va 2s . c o m email.setAuthenticator(new DefaultAuthenticator(MailInfor.EMAIL_SENDER, MailInfor.PASSWORD)); email.setSSLOnConnect(true); try { email.setFrom(MailInfor.EMAIL_SENDER); email.setSubject(subject); email.setMsg(content); email.addTo(recipientEmail); email.send(); } catch (EmailException ex) { Logger.getLogger(EmailSending.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:model.EmailJava.java
public static void enviarEmail(String userEmail) { try {//ww w.j ava 2 s. c o m Email email = new SimpleEmail(); email.setHostName("smtp.googlemail.com"); email.setSmtpPort(465); //email.setAuthenticator(new DefaultAuthenticator("username", "password")); email.setAuthentication("codbarzmgbr@gmail.com ", "streetworkout2014"); email.setSSLOnConnect(true); email.setFrom("jpmuniz88@gmail.com"); email.setSubject("CodbarZ"); email.setMsg("Junte-se ao CodbarZ. \n" + "Atleta junte-se ao nosso time, \n" + "empreendedores junte-se para nos apoiar, \n" + "Associe essa ideia, um projeto de inovado e aberto a todos que desejar evoluir com CodbarZ"); email.addTo(userEmail); email.send(); } catch (EmailException ex) { Logger.getLogger(EmailJava.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:edu.corgi.uco.sendEmails.java
public static void sendSecretaryNotification(String name) { try {/* w ww. j a va 2 s.c om*/ System.out.print("hit send"); Email email = new SimpleEmail(); System.out.print("created email file"); email.setDebug(true); email.setHostName("smtp.gmail.com"); email.setAuthenticator(new DefaultAuthenticator("ucocorgi2@gmail.com", "ucodrsung")); email.setStartTLSEnabled(true); email.setSmtpPort(587); email.setFrom("ucocorgi@gmail.com", "UCO Advisement"); email.setSubject("Advisement"); email.setMsg(name + "'s Schedule has been approved. " + "Please remove their hold promptly so they may enroll."); System.out.print("Email Address: ucocorgi@gmail.com"); email.addTo("ucocorgi@gmail.com"); System.out.print("added values"); email.send(); System.out.print("sent"); } catch (EmailException ex) { Logger.getLogger(sendEmails.class.getName()).log(Level.SEVERE, null, ex); } }