public class MailConfig extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_HOST |
static LoginOption |
DEFAULT_LOGIN |
static int |
DEFAULT_PORT |
static StarttlsOption |
DEFAULT_TLS |
Constructor and Description |
---|
MailConfig()
construct a config object with default options
|
MailConfig(JsonObject config)
construct config object from Json representation
|
MailConfig(MailConfig other)
copy config object from another MailConfig object
|
MailConfig(String hostname)
construct a config object with hostname and default options
|
MailConfig(String hostname,
int port)
construct a config object with hostname/port and default options
|
MailConfig(String hostname,
int port,
StarttlsOption starttls,
LoginOption login)
construct a config object with hostname/port and security and login options
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
String |
getAuthMethods()
get string of allowed auth methods, if set only these methods will be used
if the server supports them.
|
String |
getEhloHostname()
get the hostname to be used for HELO/EHLO
|
String |
getHostname()
get the hostname of the mailserver
|
int |
getIdleTimeout()
get the timeout for idle smtp connections (in seconds)
if not set the default is 300 seconds
set to 0 to disable the client side timeout (shutdown of the connections depends on the server's timeout in this case)
set to -1 to disable connection pooling completely
|
LoginOption |
getLogin()
get login options
|
int |
getMaxPoolSize()
get the max allowed number of open connections to the mailserver
if not set or 0, the default is 10
set to -1 to disable connection pooling completely
|
NetClientOptions |
getNetClientOptions()
get the NetClientOptions to be used when opening SMTP connections
|
String |
getPassword()
get password
|
int |
getPort()
get the port of the mailserver
|
StarttlsOption |
getStarttls()
get security (TLS) options
|
String |
getUsername()
get username
|
int |
hashCode() |
boolean |
isSsl()
get whether ssl is used on connect
|
boolean |
isTrustAll()
get whether to trust all certificates on ssl connect
|
MailConfig |
setAuthMethods(String authMethods)
set string of allowed auth methods
|
MailConfig |
setEhloHostname(String ehloHostname)
set the hostname to be used for HELO/EHLO
|
MailConfig |
setHostname(String hostname)
Set the hostname of the smtp server.
|
MailConfig |
setIdleTimeout(int idleTimeout)
set the timeout for idle smtp connections (in seconds)
if not set, the default is 300 seconds
set to 0 to disable the client side timeout (shutdown of the connections depends on the server's timeout in this case)
set to -1 to disable connection pooling completely
|
MailConfig |
setLogin(LoginOption login)
Set the login mode for the connection.
|
MailConfig |
setMaxPoolSize(int maxPoolSize)
set the max allowed number of open connections to the mail server
if not set the default is 10
if set to 0, the number of connections is not limited
set to -1 to disable connection pooling completely
|
MailConfig |
setNetClientOptions(NetClientOptions netClientOptions)
set the NetClientOptions to be used when opening SMTP connections
if not set, an options object will be created based on other settings (ssl
and trustAll)
|
MailConfig |
setPassword(String password)
Set the password for the login.
|
MailConfig |
setPort(int port)
Set the port of the smtp server.
|
MailConfig |
setSsl(boolean ssl)
Set the sslOnConnect mode for the connection.
|
MailConfig |
setStarttls(StarttlsOption starttls)
Set the tls security mode for the connection.
|
MailConfig |
setTrustAll(boolean trustAll)
set whether to trust all certificates on ssl connect the option is also
applied to STARTTLS operation
|
MailConfig |
setUsername(String username)
Set the username for the login.
|
JsonObject |
toJson()
convert config object to Json representation
|
public static final LoginOption DEFAULT_LOGIN
public static final StarttlsOption DEFAULT_TLS
public static final int DEFAULT_PORT
public static final String DEFAULT_HOST
public MailConfig()
public MailConfig(String hostname)
hostname
- the hostname of the mail serverpublic MailConfig(String hostname, int port)
hostname
- the hostname of the mail serverport
- the port of the mail serverpublic MailConfig(String hostname, int port, StarttlsOption starttls, LoginOption login)
hostname
- the hostname of the mail serverport
- the port of the mail serverstarttls
- whether to use TLS or notlogin
- whether to use Login or notpublic MailConfig(MailConfig other)
other
- the object to be copiedpublic MailConfig(JsonObject config)
config
- the config to copypublic String getHostname()
public MailConfig setHostname(String hostname)
hostname
- the hostname (default is localhost)public int getPort()
public MailConfig setPort(int port)
port
- the port (default is 25)public StarttlsOption getStarttls()
public MailConfig setStarttls(StarttlsOption starttls)
starttls
- (default is OPTIONAL)public LoginOption getLogin()
public MailConfig setLogin(LoginOption login)
login
- (default is OPTIONAL)public String getUsername()
public MailConfig setUsername(String username)
username
- the usernamepublic String getPassword()
public MailConfig setPassword(String password)
password
- the passwordpublic boolean isSsl()
public MailConfig setSsl(boolean ssl)
ssl
- true is ssl is usedpublic boolean isTrustAll()
public MailConfig setTrustAll(boolean trustAll)
trustAll
- trust all certificatespublic NetClientOptions getNetClientOptions()
public MailConfig setNetClientOptions(NetClientOptions netClientOptions)
netClientOptions
- the netClientOptions to setpublic String getAuthMethods()
public MailConfig setAuthMethods(String authMethods)
authMethods
- the authMethods to setpublic String getEhloHostname()
public MailConfig setEhloHostname(String ehloHostname)
ehloHostname
- the ehloHostname to setpublic int getMaxPoolSize()
public MailConfig setMaxPoolSize(int maxPoolSize)
public int getIdleTimeout()
public MailConfig setIdleTimeout(int idleTimeout)
public JsonObject toJson()
Copyright © 2015. All Rights Reserved.