List of usage examples for javax.mail Session setProtocolForAddress
public synchronized void setProtocolForAddress(String addresstype, String protocol)
From source file:org.nuxeo.ecm.platform.ec.notification.email.EmailHelper.java
/** * Instantiate a new session that authenticate given the protocol's properties. Initialize also the default * transport protocol handler according to the properties. * * @since 5.6/*from w ww . ja v a 2 s . co m*/ */ public static Session newSession(Properties props) { Authenticator authenticator = new EmailAuthenticator(props); Session session = Session.getDefaultInstance(props, authenticator); String protocol = props.getProperty("mail.transport.protocol"); if (protocol != null && protocol.length() > 0) { session.setProtocolForAddress("rfc822", protocol); } return session; }