-
public class MailConfig extends NetClientOptions
represents the configuration of a mail service with mail server hostname, port, security options, login options and login/password- Author:
- Alexander Lehmann
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_ALLOW_RCPT_ERRORSstatic booleanDEFAULT_DISABLE_ESMTPstatic booleanDEFAULT_ENABLE_PIPELININGstatic StringDEFAULT_HOSTstatic booleanDEFAULT_KEEP_ALIVEstatic intDEFAULT_KEEP_ALIVE_TIMEOUTThe default keep alive timeout for SMTP connection = 5 minutesstatic TimeUnitDEFAULT_KEEP_ALIVE_TIMEOUT_UNITstatic LoginOptionDEFAULT_LOGINstatic longDEFAULT_MAILS_PER_CONNECTIONstatic intDEFAULT_MAX_POOL_SIZEstatic booleanDEFAULT_MULTI_PART_ONLYstatic intDEFAULT_POOL_CLEANER_PERIODDefault pool cleaner period = 1000 ms (1 second)static TimeUnitDEFAULT_POOL_CLEANER_PERIOD_TIMEOUT_UNITstatic intDEFAULT_PORTstatic StartTLSOptionsDEFAULT_TLSstatic StringDEFAULT_USER_AGENT-
Fields inherited from class io.vertx.core.net.NetClientOptions
DEFAULT_HOSTNAME_VERIFICATION_ALGORITHM, DEFAULT_RECONNECT_ATTEMPTS, DEFAULT_RECONNECT_INTERVAL, DEFAULT_REGISTER_WRITE_HANDLER
-
Fields inherited from class io.vertx.core.net.ClientOptionsBase
DEFAULT_CONNECT_TIMEOUT, DEFAULT_METRICS_NAME
-
Fields inherited from class io.vertx.core.net.TCPSSLOptions
DEFAULT_IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT_TIME_UNIT, DEFAULT_READ_IDLE_TIMEOUT, DEFAULT_SO_LINGER, DEFAULT_SSL, DEFAULT_SSL_ENGINE, DEFAULT_TCP_CORK, DEFAULT_TCP_FAST_OPEN, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_WRITE_IDLE_TIMEOUT
-
Fields inherited from class io.vertx.core.net.NetworkOptions
DEFAULT_LOG_ACTIVITY_FORMAT, DEFAULT_LOG_ENABLED, DEFAULT_RECEIVE_BUFFER_SIZE, DEFAULT_REUSE_ADDRESS, DEFAULT_REUSE_PORT, DEFAULT_SEND_BUFFER_SIZE, DEFAULT_TRAFFIC_CLASS
-
-
Constructor Summary
Constructors Constructor Description MailConfig()construct a config object with default optionsMailConfig(JsonObject config)construct config object from Json representationMailConfig(MailConfig other)copy config object from another MailConfig objectMailConfig(String hostname)construct a config object with hostname and default optionsMailConfig(String hostname, int port)construct a config object with hostname/port and default optionsMailConfig(String hostname, int port, StartTLSOptions starttls, LoginOption login)construct a config object with hostname/port and security and login options
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MailConfigaddCrlPath(String crlPath)MailConfigaddCrlValue(Buffer crlValue)MailConfigaddDKIMSignOption(DKIMSignOptions dkimSignOptions)Adds a DKIMSignOptions.MailConfigaddEnabledCipherSuite(String suite)MailConfigaddEnabledSecureTransportProtocol(String protocol)booleanequals(Object o)StringgetAuthMethods()get string of allowed auth methods, if set only these methods will be used if the server supports them.DKIMSignOptionsgetDKIMSignOption()Gets the DKIM options.List<DKIMSignOptions>getDKIMSignOptions()Gets the DKIM options.StringgetHostname()get the hostname of the mailserverintgetKeepAliveTimeout()TimeUnitgetKeepAliveTimeoutUnit()Gets theTimeUnitof keeping the connections alive timeout.LoginOptiongetLogin()get login optionslonggetMaxMailsPerConnection()The max emails count per connection.intgetMaxPoolSize()get the max allowed number of open connections to the mailserver if not set the default is 10StringgetNtDomain()Domain used on NTLM authentication.StringgetOwnHostname()get the hostname to be used for HELO/EHLO and the Message-IDStringgetPassword()get passwordintgetPoolCleanerPeriod()TimeUnitgetPoolCleanerPeriodUnit()Gets theTimeUnitof pool cleaning period.intgetPort()get the port of the mailserverStartTLSOptionsgetStarttls()get security (TLS) optionsStringgetUserAgent()Gets the Mail User Agent(MUA) name that will be used to generate boundary and message id.StringgetUsername()get usernameStringgetWorkstation()Workstation used on NTLM authenticationinthashCode()booleanisAllowRcptErrors()get if sending allows rcpt errors (default is false)booleanisDisableEsmtp()get if ESMTP should be tried as first command (EHLO) (default is true)booleanisEnableDKIM()Is DKIM enabled, defaults to false.booleanisKeepAlive()get if connection pool is enabled default is truebooleanisMultiPartOnly()Should the mail message be always encoded as multipart.booleanisPipelining()Is the pipelining will be used if SMTP server supports it.MailConfigremoveEnabledSecureTransportProtocol(String protocol)MailConfigsetAllowRcptErrors(boolean allowRcptErrors)set if sending allows rcpt errorsMailConfigsetAuthMethods(String authMethods)set string of allowed auth methods.MailConfigsetConnectTimeout(int connectTimeout)MailConfigsetDisableEsmtp(boolean disableEsmtp)set if ESMTP should be tried as first command (EHLO)MailConfigsetDKIMSignOption(DKIMSignOptions dkimSignOptions)Sets one DKIMSignOptions for convenient.MailConfigsetDKIMSignOptions(List<DKIMSignOptions> dkimSignOptions)Sets DKIMSignOptions.MailConfigsetEnableDKIM(boolean enableDKIM)Sets true to enable DKIM Signatures, sets false to disable it.MailConfigsetEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols)MailConfigsetHostname(String hostname)Set the hostname of the smtp server.MailConfigsetHostnameVerificationAlgorithm(String hostnameVerificationAlgorithm)MailConfigsetIdleTimeout(int idleTimeout)MailConfigsetIdleTimeoutUnit(TimeUnit idleTimeoutUnit)MailConfigsetKeepAlive(boolean keepAlive)set if connection pool is enabled default is trueMailConfigsetKeepAliveTimeout(int keepAliveTimeout)Set the keep alive timeout for SMTP connection, Defaults in seconds.MailConfigsetKeepAliveTimeoutUnit(TimeUnit keepAliveTimeoutUnit)SetsTimeUnitof keeping connections in the pool alive.MailConfigsetKeyCertOptions(KeyCertOptions options)MailConfigsetLocalAddress(String localAddress)MailConfigsetLogActivity(boolean logEnabled)MailConfigsetLogin(LoginOption login)Set the login mode for the connection.MailConfigsetMaxMailsPerConnection(long maxMailsPerConnection)Sets the max emails count per connection before it gets closed.MailConfigsetMaxPoolSize(int maxPoolSize)set the max allowed number of open connections to the mail server if not set the default is 10MailConfigsetMetricsName(String metricsName)MailConfigsetMultiPartOnly(boolean multiPartOnly)Sets to encode multipart only or not.MailConfigsetNtDomain(String ntDomain)Sets the domain used on NTLM authenticationMailConfigsetOwnHostname(String ownHostname)set the hostname to be used for HELO/EHLO and the Message-IDMailConfigsetPassword(String password)Set the password for the login.MailConfigsetPipelining(boolean pipelining)Sets to enable/disable the pipelining capability if SMTP server supports it.MailConfigsetPoolCleanerPeriod(int poolCleanerPeriod)Set the connection pool cleaner period, defaults in milli seconds, a non positive value disables expiration checks and connections will remain in the pool until they are closed.MailConfigsetPoolCleanerPeriodUnit(TimeUnit poolCleanerPeriodUnit)Sets theTimeUnitof pool cleaning period.MailConfigsetPort(int port)Set the port of the smtp server.MailConfigsetProxyOptions(ProxyOptions proxyOptions)MailConfigsetReceiveBufferSize(int receiveBufferSize)MailConfigsetReconnectAttempts(int attempts)MailConfigsetReconnectInterval(long interval)MailConfigsetReuseAddress(boolean reuseAddress)MailConfigsetReusePort(boolean reusePort)MailConfigsetSendBufferSize(int sendBufferSize)MailConfigsetSoLinger(int soLinger)MailConfigsetSsl(boolean isSsl)MailConfigsetSslEngineOptions(SSLEngineOptions sslEngineOptions)MailConfigsetSslHandshakeTimeout(long sslHandshakeTimeout)MailConfigsetSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit)MailConfigsetStarttls(StartTLSOptions starttls)Set the tls security mode for the connection.MailConfigsetTcpCork(boolean tcpCork)MailConfigsetTcpFastOpen(boolean tcpFastOpen)MailConfigsetTcpKeepAlive(boolean tcpKeepAlive)MailConfigsetTcpNoDelay(boolean tcpNoDelay)MailConfigsetTcpQuickAck(boolean tcpQuickAck)MailConfigsetTrafficClass(int trafficClass)MailConfigsetTrustAll(boolean trustAll)MailConfigsetTrustOptions(TrustOptions options)MailConfigsetUseAlpn(boolean useAlpn)MailConfigsetUserAgent(String userAgent)Sets the Mail User Agent(MUA) name.MailConfigsetUsername(String username)Set the username for the login.MailConfigsetWorkstation(String workstation)Sets the workstation used on NTLM authenticationJsonObjecttoJson()convert config object to Json representation-
Methods inherited from class io.vertx.core.net.NetClientOptions
addNonProxyHost, getApplicationLayerProtocols, getHostnameVerificationAlgorithm, getReconnectAttempts, getReconnectInterval, isRegisterWriteHandler, removeEnabledCipherSuite, setActivityLogDataFormat, setApplicationLayerProtocols, setNonProxyHosts, setReadIdleTimeout, setRegisterWriteHandler, setWriteIdleTimeout
-
Methods inherited from class io.vertx.core.net.ClientOptionsBase
getConnectTimeout, getLocalAddress, getMetricsName, getNonProxyHosts, getOrCreateSSLOptions, getProxyOptions, getSslOptions, isTrustAll, setTcpUserTimeout
-
Methods inherited from class io.vertx.core.net.TCPSSLOptions
getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getKeyCertOptions, getReadIdleTimeout, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getTcpUserTimeout, getTrustOptions, getWriteIdleTimeout, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn
-
Methods inherited from class io.vertx.core.net.NetworkOptions
getActivityLogDataFormat, getLogActivity, getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, isReusePort
-
-
-
-
Field Detail
-
DEFAULT_LOGIN
public static final LoginOption DEFAULT_LOGIN
-
DEFAULT_TLS
public static final StartTLSOptions DEFAULT_TLS
-
DEFAULT_PORT
public static final int DEFAULT_PORT
- See Also:
- Constant Field Values
-
DEFAULT_HOST
public static final String DEFAULT_HOST
- See Also:
- Constant Field Values
-
DEFAULT_MAX_POOL_SIZE
public static final int DEFAULT_MAX_POOL_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_ALLOW_RCPT_ERRORS
public static final boolean DEFAULT_ALLOW_RCPT_ERRORS
- See Also:
- Constant Field Values
-
DEFAULT_KEEP_ALIVE
public static final boolean DEFAULT_KEEP_ALIVE
- See Also:
- Constant Field Values
-
DEFAULT_DISABLE_ESMTP
public static final boolean DEFAULT_DISABLE_ESMTP
- See Also:
- Constant Field Values
-
DEFAULT_USER_AGENT
public static final String DEFAULT_USER_AGENT
- See Also:
- Constant Field Values
-
DEFAULT_ENABLE_PIPELINING
public static final boolean DEFAULT_ENABLE_PIPELINING
- See Also:
- Constant Field Values
-
DEFAULT_MULTI_PART_ONLY
public static final boolean DEFAULT_MULTI_PART_ONLY
- See Also:
- Constant Field Values
-
DEFAULT_MAILS_PER_CONNECTION
public static final long DEFAULT_MAILS_PER_CONNECTION
- See Also:
- Constant Field Values
-
DEFAULT_POOL_CLEANER_PERIOD
public static final int DEFAULT_POOL_CLEANER_PERIOD
Default pool cleaner period = 1000 ms (1 second)- See Also:
- Constant Field Values
-
DEFAULT_POOL_CLEANER_PERIOD_TIMEOUT_UNIT
public static final TimeUnit DEFAULT_POOL_CLEANER_PERIOD_TIMEOUT_UNIT
-
DEFAULT_KEEP_ALIVE_TIMEOUT
public static final int DEFAULT_KEEP_ALIVE_TIMEOUT
The default keep alive timeout for SMTP connection = 5 minutes- See Also:
- Constant Field Values
-
DEFAULT_KEEP_ALIVE_TIMEOUT_UNIT
public static final TimeUnit DEFAULT_KEEP_ALIVE_TIMEOUT_UNIT
-
-
Constructor Detail
-
MailConfig
public MailConfig()
construct a config object with default options
-
MailConfig
public MailConfig(String hostname)
construct a config object with hostname and default options- Parameters:
hostname- the hostname of the mail server
-
MailConfig
public MailConfig(String hostname, int port)
construct a config object with hostname/port and default options- Parameters:
hostname- the hostname of the mail serverport- the port of the mail server
-
MailConfig
public MailConfig(String hostname, int port, StartTLSOptions starttls, LoginOption login)
construct a config object with hostname/port and security and login options- Parameters:
hostname- the hostname of the mail serverport- the port of the mail serverstarttls- whether to use TLS or notlogin- whether to use Login or not
-
MailConfig
public MailConfig(MailConfig other)
copy config object from another MailConfig object- Parameters:
other- the object to be copied
-
MailConfig
public MailConfig(JsonObject config)
construct config object from Json representation- Parameters:
config- the config to copy
-
-
Method Detail
-
setSendBufferSize
public MailConfig setSendBufferSize(int sendBufferSize)
- Overrides:
setSendBufferSizein classNetClientOptions
-
setReceiveBufferSize
public MailConfig setReceiveBufferSize(int receiveBufferSize)
- Overrides:
setReceiveBufferSizein classNetClientOptions
-
setReuseAddress
public MailConfig setReuseAddress(boolean reuseAddress)
- Overrides:
setReuseAddressin classNetClientOptions
-
setReusePort
public MailConfig setReusePort(boolean reusePort)
- Overrides:
setReusePortin classNetClientOptions
-
setTrafficClass
public MailConfig setTrafficClass(int trafficClass)
- Overrides:
setTrafficClassin classNetClientOptions
-
setTcpNoDelay
public MailConfig setTcpNoDelay(boolean tcpNoDelay)
- Overrides:
setTcpNoDelayin classNetClientOptions
-
setTcpKeepAlive
public MailConfig setTcpKeepAlive(boolean tcpKeepAlive)
- Overrides:
setTcpKeepAlivein classNetClientOptions
-
setSoLinger
public MailConfig setSoLinger(int soLinger)
- Overrides:
setSoLingerin classNetClientOptions
-
setIdleTimeout
public MailConfig setIdleTimeout(int idleTimeout)
- Overrides:
setIdleTimeoutin classNetClientOptions
-
setIdleTimeoutUnit
public MailConfig setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
- Overrides:
setIdleTimeoutUnitin classNetClientOptions
-
setKeyCertOptions
public MailConfig setKeyCertOptions(KeyCertOptions options)
- Overrides:
setKeyCertOptionsin classNetClientOptions
-
setTrustOptions
public MailConfig setTrustOptions(TrustOptions options)
- Overrides:
setTrustOptionsin classNetClientOptions
-
addEnabledCipherSuite
public MailConfig addEnabledCipherSuite(String suite)
- Overrides:
addEnabledCipherSuitein classNetClientOptions
-
addEnabledSecureTransportProtocol
public MailConfig addEnabledSecureTransportProtocol(String protocol)
- Overrides:
addEnabledSecureTransportProtocolin classNetClientOptions
-
removeEnabledSecureTransportProtocol
public MailConfig removeEnabledSecureTransportProtocol(String protocol)
- Overrides:
removeEnabledSecureTransportProtocolin classNetClientOptions
-
setUseAlpn
public MailConfig setUseAlpn(boolean useAlpn)
- Overrides:
setUseAlpnin classNetClientOptions
-
setSslEngineOptions
public MailConfig setSslEngineOptions(SSLEngineOptions sslEngineOptions)
- Overrides:
setSslEngineOptionsin classNetClientOptions
-
setTcpFastOpen
public MailConfig setTcpFastOpen(boolean tcpFastOpen)
- Overrides:
setTcpFastOpenin classNetClientOptions
-
setTcpCork
public MailConfig setTcpCork(boolean tcpCork)
- Overrides:
setTcpCorkin classNetClientOptions
-
setTcpQuickAck
public MailConfig setTcpQuickAck(boolean tcpQuickAck)
- Overrides:
setTcpQuickAckin classNetClientOptions
-
addCrlPath
public MailConfig addCrlPath(String crlPath) throws NullPointerException
- Overrides:
addCrlPathin classNetClientOptions- Throws:
NullPointerException
-
addCrlValue
public MailConfig addCrlValue(Buffer crlValue) throws NullPointerException
- Overrides:
addCrlValuein classNetClientOptions- Throws:
NullPointerException
-
setConnectTimeout
public MailConfig setConnectTimeout(int connectTimeout)
- Overrides:
setConnectTimeoutin classNetClientOptions
-
setMetricsName
public MailConfig setMetricsName(String metricsName)
- Overrides:
setMetricsNamein classNetClientOptions
-
setReconnectAttempts
public MailConfig setReconnectAttempts(int attempts)
- Overrides:
setReconnectAttemptsin classNetClientOptions
-
setReconnectInterval
public MailConfig setReconnectInterval(long interval)
- Overrides:
setReconnectIntervalin classNetClientOptions
-
setHostnameVerificationAlgorithm
public MailConfig setHostnameVerificationAlgorithm(String hostnameVerificationAlgorithm)
- Overrides:
setHostnameVerificationAlgorithmin classNetClientOptions
-
setLogActivity
public MailConfig setLogActivity(boolean logEnabled)
- Overrides:
setLogActivityin classNetClientOptions
-
setProxyOptions
public MailConfig setProxyOptions(ProxyOptions proxyOptions)
- Overrides:
setProxyOptionsin classNetClientOptions
-
setLocalAddress
public MailConfig setLocalAddress(String localAddress)
- Overrides:
setLocalAddressin classNetClientOptions
-
setSslHandshakeTimeout
public MailConfig setSslHandshakeTimeout(long sslHandshakeTimeout)
- Overrides:
setSslHandshakeTimeoutin classNetClientOptions
-
setSslHandshakeTimeoutUnit
public MailConfig setSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit)
- Overrides:
setSslHandshakeTimeoutUnitin classNetClientOptions
-
getHostname
public String getHostname()
get the hostname of the mailserver- Returns:
- hostname
-
setHostname
public MailConfig setHostname(String hostname)
Set the hostname of the smtp server.- Parameters:
hostname- the hostname (default is localhost)- Returns:
- a reference to this, so the API can be used fluently
-
getPort
public int getPort()
get the port of the mailserver- Returns:
- port
-
setPort
public MailConfig setPort(int port)
Set the port of the smtp server.- Parameters:
port- the port (default is 25)- Returns:
- a reference to this, so the API can be used fluently
-
getStarttls
public StartTLSOptions getStarttls()
get security (TLS) options- Returns:
- the security options
-
setStarttls
public MailConfig setStarttls(StartTLSOptions starttls)
Set the tls security mode for the connection.Either NONE, OPTIONAL or REQUIRED
- Parameters:
starttls- (default is OPTIONAL)- Returns:
- a reference to this, so the API can be used fluently
-
getLogin
public LoginOption getLogin()
get login options- Returns:
- the login options
-
setLogin
public MailConfig setLogin(LoginOption login)
Set the login mode for the connection.Either DISABLED, NONE, REQUIRED or XOAUTH2
- Parameters:
login- (default seeDEFAULT_LOGIN)- Returns:
- a reference to this, so the API can be used fluently
-
getUsername
public String getUsername()
get username- Returns:
- username
-
setUsername
public MailConfig setUsername(String username)
Set the username for the login.- Parameters:
username- the username- Returns:
- a reference to this, so the API can be used fluently
-
getPassword
public String getPassword()
get password- Returns:
- password
-
setPassword
public MailConfig setPassword(String password)
Set the password for the login.- Parameters:
password- the password- Returns:
- a reference to this, so the API can be used fluently
-
setSsl
public MailConfig setSsl(boolean isSsl)
- Overrides:
setSslin classNetClientOptions
-
setEnabledSecureTransportProtocols
public MailConfig setEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols)
- Overrides:
setEnabledSecureTransportProtocolsin classNetClientOptions
-
setTrustAll
public MailConfig setTrustAll(boolean trustAll)
- Overrides:
setTrustAllin classNetClientOptions
-
getAuthMethods
public String getAuthMethods()
get string of allowed auth methods, if set only these methods will be used if the server supports them. If null or empty all supported methods may be used- Returns:
- the authMethods
-
setAuthMethods
public MailConfig setAuthMethods(String authMethods)
set string of allowed auth methods. if set only these methods will be used if the server supports them. If null or empty all supported methods may be used- Parameters:
authMethods- the authMethods to set- Returns:
- a reference to this, so the API can be used fluently
-
getOwnHostname
public String getOwnHostname()
get the hostname to be used for HELO/EHLO and the Message-ID- Returns:
- my own hostname
-
setOwnHostname
public MailConfig setOwnHostname(String ownHostname)
set the hostname to be used for HELO/EHLO and the Message-ID- Parameters:
ownHostname- my own hostname to set- Returns:
- a reference to this, so the API can be used fluently
-
getMaxPoolSize
public int getMaxPoolSize()
get the max allowed number of open connections to the mailserver if not set the default is 10- Returns:
- max pool size value
-
setMaxPoolSize
public MailConfig setMaxPoolSize(int maxPoolSize)
set the max allowed number of open connections to the mail server if not set the default is 10- Returns:
- this to be able to use the object fluently
-
isKeepAlive
public boolean isKeepAlive()
get if connection pool is enabled default is trueif the connection pooling is disabled, the max number of sockets is enforced nevertheless
- Returns:
- keep alive value
-
setKeepAlive
public MailConfig setKeepAlive(boolean keepAlive)
set if connection pool is enabled default is trueif the connection pooling is disabled, the max number of sockets is enforced nevertheless
- Returns:
- this to be able to use the object fluently
-
isAllowRcptErrors
public boolean isAllowRcptErrors()
get if sending allows rcpt errors (default is false)if true, the mail will be sent to the recipients that the server accepted, if any
- Returns:
- the allowRcptErrors
-
setAllowRcptErrors
public MailConfig setAllowRcptErrors(boolean allowRcptErrors)
set if sending allows rcpt errorsif true, the mail will be sent to the recipients that the server accepted, if any
- Parameters:
allowRcptErrors- the allowRcptErrors to set (default is false)- Returns:
- this to be able to use the object fluently
-
isDisableEsmtp
public boolean isDisableEsmtp()
get if ESMTP should be tried as first command (EHLO) (default is true)rfc 1869 states that clients should always attempt EHLO as first command to determine if ESMTP is supported, if this returns an error code, HELO is tried to use old SMTP. If there is a server that does not support EHLO and does not give an error code back, the connection should be closed and retried with HELO. We do not do that and rather support turning off ESMTP with a setting. The odds of this actually happening are very small since the client will not connect to arbitrary smtp hosts on the internet. Since the client knows that is connects to a host that doesn't support ESMTP/EHLO in that way, the property has to be set to false.
- Returns:
- the disableEsmtp
-
setDisableEsmtp
public MailConfig setDisableEsmtp(boolean disableEsmtp)
set if ESMTP should be tried as first command (EHLO)rfc 1869 states that clients should always attempt EHLO as first command to determine if ESMTP is supported, if this returns an error code, HELO is tried to use old SMTP. If there is a server that does not support EHLO and does not give an error code back, the connection should be closed and retried with HELO. We do not do that and rather support turning off ESMTP with a setting. The odds of this actually happening are very small since the client will not connect to arbitrary smtp hosts on the internet. Since the client knows that is connects to a host that doesn't support ESMTP/EHLO in that way, the property has to be set to false.
- Parameters:
disableEsmtp- the disableEsmtp to set (default is true)- Returns:
- this to be able to use the object fluently
-
getUserAgent
public String getUserAgent()
Gets the Mail User Agent(MUA) name that will be used to generate boundary and message id.- Returns:
- the Mail User Agent(MUA) name used to generate boundary and message id
-
setUserAgent
public MailConfig setUserAgent(String userAgent)
Sets the Mail User Agent(MUA) name.It is used to generate the boundary in case of MultiPart email and the Message-ID. If
nullis set, DEFAULT_USER_AGENT is used.- Parameters:
userAgent- the Mail User Agent(MUA) name used to generate boundary and message id length of userAgent must be smaller than 40 so that the generated boundary has no longer 70 characters.- Returns:
- this to be able to use the object fluently
-
isEnableDKIM
public boolean isEnableDKIM()
Is DKIM enabled, defaults to false.- Returns:
- enableDKIM
-
setEnableDKIM
public MailConfig setEnableDKIM(boolean enableDKIM)
Sets true to enable DKIM Signatures, sets false to disable it.This is used most for temporary disable DKIM without removing DKIM opations from current config.
- Parameters:
enableDKIM- if DKIM Singature should be enabled- Returns:
- this to be able to use the object fluently
-
getDKIMSignOptions
public List<DKIMSignOptions> getDKIMSignOptions()
Gets the DKIM options.- Returns:
- dkimSignOptions
-
addDKIMSignOption
public MailConfig addDKIMSignOption(DKIMSignOptions dkimSignOptions)
Adds a DKIMSignOptions.- Parameters:
dkimSignOptions- the DKIMSignOptions- Returns:
- this to be able to use the object fluently
-
setDKIMSignOptions
public MailConfig setDKIMSignOptions(List<DKIMSignOptions> dkimSignOptions)
Sets DKIMSignOptions.- Parameters:
dkimSignOptions- the DKIM options- Returns:
- this to be able to use the object fluently
-
setDKIMSignOption
public MailConfig setDKIMSignOption(DKIMSignOptions dkimSignOptions)
Sets one DKIMSignOptions for convenient.- Parameters:
dkimSignOptions- the DKIM options- Returns:
- this to be able to use the object fluently
-
getDKIMSignOption
public DKIMSignOptions getDKIMSignOption()
Gets the DKIM options.- Returns:
- dkimSignOptions of the first one or null if nothing specified yet.
-
isPipelining
public boolean isPipelining()
Is the pipelining will be used if SMTP server supports it. Default to true.- Returns:
- if enable pipelining capability if SMTP server supports it.
-
setPipelining
public MailConfig setPipelining(boolean pipelining)
Sets to enable/disable the pipelining capability if SMTP server supports it.- Parameters:
pipelining- enable pipelining or not- Returns:
- this to be able to use the object fluently
-
isMultiPartOnly
public boolean isMultiPartOnly()
Should the mail message be always encoded as multipart.- Returns:
- if the mail message will be encoded as multipart only.
-
setMultiPartOnly
public MailConfig setMultiPartOnly(boolean multiPartOnly)
Sets to encode multipart only or not. When sets totrue, the mail message will be encoded as multipart even for simple mails without attachments, see https://github.com/vert-x3/vertx-mail-client/issues/161.- Parameters:
multiPartOnly- encoded as multipart only or not, default tofalse.- Returns:
- this to be able to use the object fluently
-
getPoolCleanerPeriod
public int getPoolCleanerPeriod()
- Returns:
- the connection pool cleaner period in ms.
-
setPoolCleanerPeriod
public MailConfig setPoolCleanerPeriod(int poolCleanerPeriod)
Set the connection pool cleaner period, defaults in milli seconds, a non positive value disables expiration checks and connections will remain in the pool until they are closed.- Parameters:
poolCleanerPeriod- the pool cleaner period- Returns:
- a reference to this, so the API can be used fluently
-
getKeepAliveTimeout
public int getKeepAliveTimeout()
- Returns:
- the keep alive timeout value in seconds for SMTP connections
-
setKeepAliveTimeout
public MailConfig setKeepAliveTimeout(int keepAliveTimeout)
Set the keep alive timeout for SMTP connection, Defaults in seconds. This value determines how long a connection remains unused in the pool before being evicted and closed. A timeout of0means there is no timeout.- Parameters:
keepAliveTimeout- the timeout, in seconds- Returns:
- a reference to this, so the API can be used fluently
-
getPoolCleanerPeriodUnit
public TimeUnit getPoolCleanerPeriodUnit()
Gets theTimeUnitof pool cleaning period. Defaults toTimeUnit.MILLISECONDS- Returns:
- the
TimeUnitof the pool cleaning period.
-
setPoolCleanerPeriodUnit
public MailConfig setPoolCleanerPeriodUnit(TimeUnit poolCleanerPeriodUnit)
Sets theTimeUnitof pool cleaning period.- Parameters:
poolCleanerPeriodUnit- theTimeUnitof the pool cleaning period.- Returns:
- a reference to this, so the API can be used fluently
-
getKeepAliveTimeoutUnit
public TimeUnit getKeepAliveTimeoutUnit()
Gets theTimeUnitof keeping the connections alive timeout. Defaults toTimeUnit.SECONDS- Returns:
- the
TimeUnitof keeping the connections alive timeout
-
setKeepAliveTimeoutUnit
public MailConfig setKeepAliveTimeoutUnit(TimeUnit keepAliveTimeoutUnit)
SetsTimeUnitof keeping connections in the pool alive.- Parameters:
keepAliveTimeoutUnit- theTimeUnitof keeping the connections alive timeout- Returns:
- a reference to this, so the API can be used fluently
-
getNtDomain
public String getNtDomain()
Domain used on NTLM authentication.- Returns:
- the domain name used on NTLM authentication
-
setNtDomain
public MailConfig setNtDomain(String ntDomain)
Sets the domain used on NTLM authentication- Parameters:
ntDomain- the NTLM domain- Returns:
- a reference to this, so the API can be used fluently
-
getWorkstation
public String getWorkstation()
Workstation used on NTLM authentication- Returns:
- the workstation used on NTLM authentication
-
setWorkstation
public MailConfig setWorkstation(String workstation)
Sets the workstation used on NTLM authentication- Parameters:
workstation- the workstation- Returns:
- a reference to this, so the API can be used fluently
-
setMaxMailsPerConnection
public MailConfig setMaxMailsPerConnection(long maxMailsPerConnection)
Sets the max emails count per connection before it gets closed.Some SMTP servers have requirement to allow only a number of emails sent per connection.
- Parameters:
maxMailsPerConnection- the emails count per connection- Returns:
- a reference to this, so the API can be used fluently
-
getMaxMailsPerConnection
public long getMaxMailsPerConnection()
The max emails count per connection.- Returns:
- the max emails count per connection before it gets closed.
-
toJson
public JsonObject toJson()
convert config object to Json representation- Overrides:
toJsonin classNetClientOptions- Returns:
- json object of the config
-
-