List of usage examples for org.apache.commons.mail Email setFrom
public Email setFrom(final String email, final String name) throws EmailException
From source file:com.github.triceo.robozonky.notifications.email.AbstractEmailingListener.java
private static Email createNewEmail(final EmailNotificationProperties properties) throws EmailException { final Email email = new SimpleEmail(); email.setCharset(Defaults.CHARSET.displayName()); email.setHostName(properties.getSmtpHostname()); email.setSmtpPort(properties.getSmtpPort()); email.setStartTLSRequired(properties.isStartTlsRequired()); email.setSSLOnConnect(properties.isSslOnConnectRequired()); email.setAuthentication(properties.getSmtpUsername(), properties.getSmtpPassword()); email.setFrom(properties.getSender(), "RoboZonky @ " + properties.getLocalHostAddress()); email.addTo(properties.getRecipient()); return email; }
From source file:edu.corgi.uco.sendEmails.java
public static void sendStudentSignUp(String studentFirstName, String studentLastName, Date time) { try {/* w w w. j a v a2s . c o m*/ 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 Update"); email.setMsg("You have a new appointment with " + studentFirstName + " " + studentLastName + " on " + time + ". Any previously " + "scheduled appointments with them have been canceled."); 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); } }
From source file:edu.corgi.uco.sendEmails.java
public static void sendSecretaryNotification(String name) { try {/* ww w.ja v a 2 s . com*/ 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); } }
From source file:edu.corgi.uco.sendEmails.java
public static void sendAdvisorCancel(String emailAddress, String studentFirstName, String studentLastName) { try {//from ww w. j a v a 2 s . c o m 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 CS Corgi"); email.setSubject("Advisement Update"); email.setMsg( studentFirstName + " " + studentLastName + "your appointment has been canceled by the advisor." + "You will need to log in to CORGI and sign up for another appointment to get advised." + "Thank you."); System.out.print("Email Address: " + emailAddress); email.addTo(emailAddress); System.out.print("added values"); email.send(); System.out.print("sent"); } catch (EmailException ex) { Logger.getLogger(sendEmails.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:edu.corgi.uco.sendEmails.java
public static void sendStudentConfirmation(String fn, String ln, Date date, String email2) { try {/*from w w w . j a va 2 s .co m*/ 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 Update"); email.setMsg(fn + " " + ln + ", you have signed up for an advisement appointment at " + date + ". It is recommended that you use the Corgi system to define your " + "preferred schedule for next semester prior to your meeting."); System.out.print("Email Address: ucocorgi@gmail.com"); email.addTo(email2); System.out.print("added values"); email.send(); System.out.print("sent"); } catch (EmailException ex) { Logger.getLogger(sendEmails.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:de.maklerpoint.office.Schnittstellen.Email.SimpleEmailSender.java
/** * // w ww . j a v a 2 s .c o m * @param adress * @param Subject * @param body * @throws EmailException */ public static void sendSimpleEMail(String adress, String Subject, String body) throws EmailException { Email email = new SimpleEmail(); email.setHostName(Config.get("mailHost", "")); email.setSmtpPort(Config.getConfigInt("emailPort", 25)); email.setTLS(Config.getConfigBoolean("mailTLS", false)); email.setSSL(Config.getConfigBoolean("mailSSL", false)); //email.setSslSmtpPort(Config.getConfigInt("emailPort", 25)); email.setAuthenticator( new DefaultAuthenticator(Config.get("mailUsername", ""), Config.get("mailPassword", ""))); email.setFrom(Config.get("mailSendermail", ""), Config.get("mailSender", "")); email.setSubject(Subject); email.setMsg(body); email.addTo(adress); email.send(); }
From source file:ar.com.pahema.utils.MailSender.java
public static void enviar(String destino, Paquete paquete) throws EmailException { try {/* w ww .ja va 2s . c o m*/ Email mail = new SimpleEmail(); //Configuracion necesaria para GMAIL mail.setHostName("mail.pahema.com.ar"); //mail.setTLS(true); mail.setSmtpPort(25); //mail.setSSL(true); //En esta seccion colocar cuenta de usuario de Gmail y contrasea mail.setAuthentication("dante@pahema.com.ar", "Fuerza2015"); //Cuenta de Email Destino // AC? IRIA LA DE ADMINISTRACION DE PAHEMA. mail.addTo("dante.gs@hotmail.com"); mail.addTo(destino); //Cuenta de Email Origen, la misma con la que nos autenticamos mail.setFrom("dante@pahema.com.ar", "Pahema - Sistema Tango"); //Titulo del Email mail.setSubject("Aviso de finalizacin de paquete de horas."); //Contenido del Email mail.setMsg("Estimado cliente,\n" + "Le informamos que su paquete de " + (int) paquete.getCantidadHoras() + " horas est por finalizar.\n" + "Le quedan por usar: " + (int) paquete.getHorasRestantes() + " horas.\n" + "Por favor comunquese con Pahema para el detalle de sus consumos: 4952 - 4789.\n" + "Muchas gracias.\n" + "Administracin."); mail.send(); } catch (EmailException e) { System.out.println(e.getMessage()); throw new RuntimeException("Ocurrio un error en el envio del mail"); } }
From source file:iddb.core.util.MailManager.java
private void setEmailProps(Email email) throws EmailException { email.setFrom(props.getProperty("from"), "IPDB"); if (props.containsKey("bounce")) email.setBounceAddress(props.getProperty("bounce")); if (props.containsKey("host")) email.setHostName(props.getProperty("host")); if (props.containsKey("port")) email.setSmtpPort(Integer.parseInt(props.getProperty("port"))); if (props.containsKey("username")) email.setAuthenticator(/*from w w w . j a v a2 s. c o m*/ new DefaultAuthenticator(props.getProperty("username"), props.getProperty("password"))); if (props.containsKey("ssl") && props.getProperty("ssl").equalsIgnoreCase("true")) email.setSSL(true); if (props.containsKey("tls") && props.getProperty("tls").equalsIgnoreCase("true")) email.setTLS(true); if (props.containsKey("debug") && props.getProperty("debug").equalsIgnoreCase("true")) email.setDebug(true); }
From source file:com.cqecom.cms.components.eMailer.TrialOsubEmailController.java
public void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) { try {// www .j a va 2s. c o m String strLicenseName = ""; String strLicensePassword = ""; String strLanguageName = ""; String strEndsAt = ""; String strLanguageSlug = ""; String strTrialUrl = ""; String strOfferPromo = ""; String strEmailTemplateUrl = ""; String strFollowupEmailTemplateUrl = ""; String strEmailSubject = ""; String strEmailFrom = ""; String followupEmail = ""; String strFollowupEmailSubject = ""; if (request != null) { strLicenseName = getParamValue(request, "license_name"); strLicensePassword = getParamValue(request, "license_password"); strLanguageName = getParamValue(request, "language_name"); strEndsAt = getParamValue(request, "ends_at"); strLanguageSlug = getParamValue(request, "language_slug"); strTrialUrl = getParamValue(request, "trial_url"); strOfferPromo = getParamValue(request, "offer_promo"); strEmailTemplateUrl = getParamValue(request, "email_template_url"); strFollowupEmailTemplateUrl = getParamValue(request, "followup_email_template_url"); strEmailSubject = getParamValue(request, "email_subject"); strFollowupEmailSubject = getParamValue(request, "followup_email_subject"); strEmailFrom = getParamValue(request, "email_from"); followupEmail = getParamValue(request, "followup_email"); } if (followupEmail.equals("true")) { strEmailTemplateUrl = strFollowupEmailTemplateUrl; strEmailSubject = strFollowupEmailSubject; } session = repository.loginAdministrative(null); String pageHtml = session.getRootNode().getNode(strEmailTemplateUrl + "/jcr:content/content") .getProperty("text").getValue().getString(); pageHtml = replaceToken(pageHtml, "license_name", strLicenseName); pageHtml = replaceToken(pageHtml, "license_password", strLicensePassword); pageHtml = replaceToken(pageHtml, "language_name", strLanguageName); pageHtml = replaceToken(pageHtml, "ends_at", strEndsAt); pageHtml = replaceToken(pageHtml, "language_slug", strLanguageSlug); pageHtml = replaceToken(pageHtml, "trial_url", strTrialUrl); pageHtml = replaceToken(pageHtml, "offer_promo", strOfferPromo); Email emailObj = new HtmlEmail(); emailObj.setContent(pageHtml.toString(), "text/html"); if (!strEmailFrom.equals("")) emailObj.setFrom(strEmailFrom, "CqEcom " + strLanguageName + " Trial"); if (!strLicenseName.equals("")) emailObj.addTo(strLicenseName); if (!strEmailSubject.equals("")) emailObj.setSubject(strEmailSubject); ms.sendEmail(emailObj); logger.info("Mail sent to => " + strLicenseName); } catch (Exception ex) { logger.info(ex.getMessage()); } finally { if (session != null) session.logout(); } }
From source file:com.projetIF4.controller.MailControleur.java
public void mail() throws EmailException { Email email = new SimpleEmail(); email.setCharset("UTF-8"); email.setHostName("smtp.googlemail.com"); email.setSmtpPort(465);/*from www .j a v a 2 s . c o m*/ email.setAuthenticator(new DefaultAuthenticator("fst.rnu.info@gmail.com", "adminFST123456789")); email.setSSLOnConnect(true); email.setFrom("fst.rnu.info@gmail.com", "Dpartement Informatique FST"); email.setSubject(objet); email.setMsg(message); email.addTo(mailDestination); email.send(); }