List of usage examples for org.apache.commons.mail SimpleEmail setStartTLSEnabled
public Email setStartTLSEnabled(final boolean startTlsEnabled)
From source file:br.edu.ifpb.padroes.projeto.sisbiblioteca.mail.EmprestimoEmail.java
private SimpleEmail createSimpleEmail() { SimpleEmail simpleEmail = new SimpleEmail(); simpleEmail.setHostName(hostName);/* ww w . ja v a 2s . co m*/ simpleEmail.setSmtpPort(port); simpleEmail.setStartTLSEnabled(true); simpleEmail.setSSLOnConnect(true); return simpleEmail; }
From source file:org.exoplatform.social.notification.mail.FakeMailService.java
@Override public void sendMessage(Message message) throws Exception { SimpleEmail email = new SimpleEmail(); email.setHostName("localhost"); email.setSmtpPort(2525);/*from w w w.j a va2s. co m*/ email.setStartTLSEnabled(true); email.setFrom(message.getFrom()); email.setSubject(message.getSubject()); email.setContent(message.getBody(), EmailConstants.TEXT_HTML); email.addTo(message.getTo()); email.send(); }
From source file:org.sonar.server.notification.email.EmailNotificationChannel.java
private void configureSecureConnection(SimpleEmail email) { if (StringUtils.equalsIgnoreCase(configuration.getSecureConnection(), "ssl")) { email.setSSLOnConnect(true);//from w w w . ja v a 2s . co m email.setSslSmtpPort(String.valueOf(configuration.getSmtpPort())); // this port is not used except in EmailException message, that's why it's set with the same value than SSL port. // It prevents from getting bad message. email.setSmtpPort(configuration.getSmtpPort()); } else if (StringUtils.equalsIgnoreCase(configuration.getSecureConnection(), "starttls")) { email.setStartTLSEnabled(true); email.setStartTLSRequired(true); email.setSmtpPort(configuration.getSmtpPort()); } else if (StringUtils.isBlank(configuration.getSecureConnection())) { email.setSmtpPort(configuration.getSmtpPort()); } else { throw new SonarException( "Unknown type of SMTP secure connection: " + configuration.getSecureConnection()); } }
From source file:org.vas.mail.Smtp.java
public Email emptyEmail() { SimpleEmail email = new SimpleEmail(); email.setAuthentication(user, pwd);/*w w w. j ava2s .c o m*/ email.setSSLOnConnect(ssl); email.setStartTLSEnabled(tls); email.setStartTLSRequired(tlsRequired); email.setHostName(host); email.setSmtpPort(port); return email; }