public interface JavaMailSessionBuilder
JavaMailSessionBuilderFactory.INSTANCE| Modifier and Type | Method and Description |
|---|---|
JavaMailSession |
build()
Builds a new
Session object and returns wrapper. |
JavaMailSessionBuilder |
customPort(int port)
Sets a standard port number for SMTP gateway.
|
JavaMailSessionBuilder |
host(String host,
AlwaysTrustSSL alwaysTrustSSL)
Sets the hostname of SMTP gateway.
|
JavaMailSessionBuilder |
port(SmtpPort smtpPort)
Sets a standard port number for SMTP gateway.
|
Properties |
properties()
Optional: Directly access
Properties collection used to build final Session object. |
JavaMailSessionBuilder |
usernameAndPassword(String username,
String password)
Optional: Sets the username and password to authenticate with SMTP gateway.
|
JavaMailSessionBuilder host(String host, AlwaysTrustSSL alwaysTrustSSL)
host - hostname of SMTP gateway, e.g., "smtp.gmail.com"
alwaysTrustSSL - set this option if you have trouble with SSL certificatesIllegalArgumentException - if host is empty or all whitespaceport(SmtpPort)JavaMailSessionBuilder port(SmtpPort smtpPort)
customPort(int).customPort(int)JavaMailSessionBuilder customPort(int port)
port(SmtpPort).port - must not be zero or negativeIllegalArgumentException - if port is invalidport(SmtpPort)JavaMailSessionBuilder usernameAndPassword(String username, String password)
username - must not be empty or all whitespacepassword - must not be empty or all whitespaceIllegalArgumentException - if username or password is empty or all whitespaceProperties properties()
Properties collection used to build final Session object.
Use this method if you need to customise properties before calling build().
JavaMailSession build()
Session object and returns wrapper.Session.getInstance(Properties)Copyright © 2013–2020. All rights reserved.