List of usage examples for org.apache.commons.mail Email setSubject
public Email setSubject(final String aSubject)
From source file:model.EmailJava.java
public static void enviarEmail(String userEmail) { try {/*from w w w .jav a2 s . co 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 sendAdvisorCancel(String emailAddress, String studentFirstName, String studentLastName) { try {//from ww w . j a va 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 sendStudentSignUp(String studentFirstName, String studentLastName, Date time) { try {/*from w ww. j a v a2 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("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 {/*from w w w. j a v a2 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 sendStudentConfirmation(String fn, String ln, Date date, String email2) { try {//from ww w . j a v a2 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 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:com.esofthead.mycollab.servlet.InstallUtils.java
public static void checkSMTPConfig(String host, int port, String username, String password, boolean auth, boolean isStartTls, boolean isSSL) { try {/* w w w. jav a2 s . c o m*/ Properties props = new Properties(); if (auth) { props.setProperty("mail.smtp.auth", "true"); } else { props.setProperty("mail.smtp.auth", "false"); } if (isStartTls) { props.setProperty("mail.smtp.starttls.enable", "true"); props.setProperty("mail.smtp.startssl.enable", "true"); } else if (isSSL) { props.setProperty("mail.smtp.startssl.enable", "false"); props.setProperty("mail.smtp.ssl.enable", "true"); props.setProperty("mail.smtp.ssl.socketFactory.fallback", "false"); } Email email = new SimpleEmail(); email.setHostName(host); email.setSmtpPort(port); email.setAuthenticator(new DefaultAuthenticator(username, password)); if (isStartTls) { email.setStartTLSEnabled(true); } else { email.setStartTLSEnabled(false); } if (isSSL) { email.setSSLOnConnect(true); } else { email.setSSLOnConnect(false); } email.setFrom(username); email.setSubject("MyCollab Test Email"); email.setMsg("This is a test mail ... :-)"); email.addTo(username); email.send(); } catch (Exception e) { throw new UserInvalidInputException(e); } }
From source file:de.maklerpoint.office.Schnittstellen.Email.SimpleEmailSender.java
/** * /*from w w w . j a va2 s.com*/ * @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:AccessControl.java
/** * Send email message for external notifications * * @param subject Email Subject Text/*from w ww .j av a 2 s . co m*/ * @param message Email Message Text */ private static void sendEmail(String subject, String message) { try { if (EMAIL_ENABLED && EMAIL_FROM != null && !EMAIL_FROM.isEmpty()) { Email email = new SimpleEmail(); email.setHostName(EMAIL_SERVER); email.setSmtpPort(EMAIL_PORT); email.setFrom(EMAIL_FROM); email.addTo(EMAIL_TO); email.setSubject(subject); email.setMsg(message); email.send(); } } catch (Exception ex) { ex.printStackTrace(); } }
From source file:at.treedb.util.Mail.java
public static void sendMail(String smtpHost, int smtpPort, TransportSecurity transportSecurity, String smtpUser, String smtpPassword, String mailTo, String mailFrom, String subject, String message) throws Exception { Objects.requireNonNull(mailTo, "Mail.sendMail(): mailTo can not be null!"); Objects.requireNonNull(subject, "Mail.sendMail(): subject can not be null!"); Objects.requireNonNull(message, "Mail.sendMail(): message can not be null!"); Email email = new SimpleEmail(); email.setHostName(smtpHost);/* ww w .j a v a 2 s . co m*/ email.setAuthenticator(new DefaultAuthenticator(smtpUser, smtpPassword)); if (transportSecurity == TransportSecurity.SSL) { email.setSSLOnConnect(true); email.setSSLCheckServerIdentity(false); } else if (transportSecurity == TransportSecurity.STARTTLS) { email.setStartTLSRequired(true); } email.setSmtpPort(smtpPort); if (mailFrom != null && !mailFrom.isEmpty()) { email.setFrom(smtpUser); } email.setSubject(subject); email.setMsg(message); email.addTo(mailTo); email.send(); }
From source file:FacultyAdvisement.StudentRepository.java
public static void adminUpdate(DataSource ds, Student student, String oldUsername) throws SQLException { Connection conn = ds.getConnection(); if (conn == null) { throw new SQLException("conn is null; Can't get db connection"); }/*from ww w .j a va 2s . co m*/ try { PreparedStatement ps; ps = conn.prepareStatement( "Update STUDENT set EMAIL=?, FIRSTNAME=?, LASTNAME=?, MAJORCODE=?, PHONE=?, ADVISED=? where STUID=?"); ps.setString(1, student.getUsername()); ps.setString(2, student.getFirstName()); ps.setString(3, student.getLastName()); ps.setString(4, student.getMajorCode()); ps.setString(5, student.getPhoneNumber()); if (student.isAdvised()) { ps.setString(6, "true"); } else { ps.setString(6, "false"); } ps.setString(7, student.getId()); ps.executeUpdate(); ps = conn.prepareStatement("Update USERTABLE set USERNAME=? where USERNAME=?"); ps.setString(1, student.getUsername()); ps.setString(2, oldUsername); ps.executeUpdate(); ps = conn.prepareStatement("Update GROUPTABLE set USERNAME=? where USERNAME=?"); ps.setString(1, student.getUsername()); ps.setString(2, oldUsername); ps.executeUpdate(); if (student.isResetPassword()) { String newPassword = UUID.randomUUID().toString(); String encryptedPassword = SHA256Encrypt.encrypt(newPassword); ps = conn.prepareStatement("Update USERTABLE set PASSWORD=? where USERNAME=?"); ps.setString(1, encryptedPassword); ps.setString(2, student.getUsername()); ps.executeUpdate(); Email email = new HtmlEmail(); email.setHostName("smtp.googlemail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("uco.faculty.advisement", "!@#$1234")); email.setSSLOnConnect(true); email.setFrom("uco.faculty.advisement@gmail.com"); email.setSubject("UCO Faculty Advisement Password Change"); email.setMsg("<font size=\"3\">An admin has resetted your password, your new password is \"" + newPassword + "\"." + "\n<p align=\"center\">UCO Faculty Advisement</p></font>"); email.addTo(student.getUsername()); email.send(); } } catch (EmailException ex) { Logger.getLogger(StudentRepository.class.getName()).log(Level.SEVERE, null, ex); } finally { conn.close(); } //students = (HashMap<String, StudentPOJO>) readAll(); // reload the updated info }