List of usage examples for org.apache.commons.mail SimpleEmail setStartTLSRequired
public Email setStartTLSRequired(final boolean startTlsRequired)
From source file:org.sonar.server.notification.email.EmailNotificationChannel.java
private void configureSecureConnection(SimpleEmail email) { if (StringUtils.equalsIgnoreCase(configuration.getSecureConnection(), "ssl")) { email.setSSLOnConnect(true);//w ww . j a v a 2 s .com 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 av a2s .co m*/ email.setSSLOnConnect(ssl); email.setStartTLSEnabled(tls); email.setStartTLSRequired(tlsRequired); email.setHostName(host); email.setSmtpPort(port); return email; }