Class MailConfig
- Author:
- Alexander Lehmann
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final booleanstatic final booleanstatic final Stringstatic final booleanstatic final intThe default keep alive timeout for SMTP connection = 5 minutesstatic final TimeUnitstatic final LoginOptionstatic final longstatic final intstatic final booleanstatic final intDefault pool cleaner period = 1000 ms (1 second)static final TimeUnitstatic final intstatic final StartTLSOptionsstatic final StringFields inherited from class NetClientOptions
DEFAULT_HOSTNAME_VERIFICATION_ALGORITHM, DEFAULT_RECONNECT_ATTEMPTS, DEFAULT_RECONNECT_INTERVAL, DEFAULT_REGISTER_WRITE_HANDLERFields inherited from class ClientOptionsBase
DEFAULT_CONNECT_TIMEOUT, DEFAULT_METRICS_NAMEFields inherited from class 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_KEEAPLIVE_COUNT, DEFAULT_TCP_KEEAPLIVE_IDLE_SECONDS, DEFAULT_TCP_KEEAPLIVE_INTERVAL_SECONDS, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_WRITE_IDLE_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionconstruct 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
Modifier and TypeMethodDescriptionaddCrlPath(String crlPath) Add a CRL pathaddCrlValue(Buffer crlValue) Add a CRL valueaddDKIMSignOption(DKIMSignOptions dkimSignOptions) Adds a DKIMSignOptions.addEnabledCipherSuite(String suite) Add an enabled cipher suite, appended to the ordered suites.addEnabledSecureTransportProtocol(String protocol) Add an enabled SSL/TLS protocols, appended to the ordered protocols.booleanget string of allowed auth methods, if set only these methods will be used if the server supports them.Gets the DKIM options.Gets the DKIM options.get the hostname of the mailserverintGets theTimeUnitof keeping the connections alive timeout.getLogin()get login optionslongThe max emails count per connection.intget the max allowed number of open connections to the mailserver if not set the default is 10Domain used on NTLM authentication.get the hostname to be used for HELO/EHLO and the Message-IDget passwordintGets theTimeUnitof pool cleaning period.intgetPort()get the port of the mailserverget security (TLS) optionsGets the Mail User Agent(MUA) name that will be used to generate boundary and message id.get usernameWorkstation used on NTLM authenticationinthashCode()booleanget if sending allows rcpt errors (default is false)booleanget if ESMTP should be tried as first command (EHLO) (default is true)booleanIs DKIM enabled, defaults to false.booleanget if connection pool is enabled default is truebooleanShould the mail message be always encoded as multipart.booleanIs the pipelining will be used if SMTP server supports it.removeEnabledSecureTransportProtocol(String protocol) Removes an enabled SSL/TLS protocol from the ordered protocols.setAllowRcptErrors(boolean allowRcptErrors) set if sending allows rcpt errorssetAuthMethods(String authMethods) set string of allowed auth methods. if set only these methods will be used if the server supports them.setConnectTimeout(int connectTimeout) Set the connect timeoutsetDisableEsmtp(boolean disableEsmtp) set if ESMTP should be tried as first command (EHLO)setDKIMSignOption(DKIMSignOptions dkimSignOptions) Sets one DKIMSignOptions for convenient.setDKIMSignOptions(List<DKIMSignOptions> dkimSignOptions) Sets DKIMSignOptions.setEnableDKIM(boolean enableDKIM) Sets true to enable DKIM Signatures, sets false to disable it.setEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols) Sets the list of enabled SSL/TLS protocols.setHostname(String hostname) Set the hostname of the smtp server.setHostnameVerificationAlgorithm(String hostnameVerificationAlgorithm) Set the hostname verification algorithm interval To disable hostname verification, set hostnameVerificationAlgorithm to an empty StringsetIdleTimeout(int idleTimeout) Set the idle timeout, default time unit is seconds.setIdleTimeoutUnit(TimeUnit idleTimeoutUnit) Set the idle timeout unit.setKeepAlive(boolean keepAlive) set if connection pool is enabled default is truesetKeepAliveTimeout(int keepAliveTimeout) Set the keep alive timeout for SMTP connection, Defaults in seconds.setKeepAliveTimeoutUnit(TimeUnit keepAliveTimeoutUnit) SetsTimeUnitof keeping connections in the pool alive.setKeyCertOptions(KeyCertOptions options) Set the key/cert options.setLocalAddress(String localAddress) Set the local interface to bind for network connections.setLogActivity(boolean logEnabled) Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.setLogin(LoginOption login) Set the login mode for the connection.setMaxMailsPerConnection(long maxMailsPerConnection) Sets the max emails count per connection before it gets closed.setMaxPoolSize(int maxPoolSize) set the max allowed number of open connections to the mail server if not set the default is 10setMetricsName(String metricsName) Set the metrics name identifying the reported metrics, useful for grouping metrics with the same name.setMultiPartOnly(boolean multiPartOnly) Sets to encode multipart only or not.setNtDomain(String ntDomain) Sets the domain used on NTLM authenticationsetOwnHostname(String ownHostname) set the hostname to be used for HELO/EHLO and the Message-IDsetPassword(String password) Set the password for the login.setPipelining(boolean pipelining) Sets to enable/disable the pipelining capability if SMTP server supports it.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.setPoolCleanerPeriodUnit(TimeUnit poolCleanerPeriodUnit) Sets theTimeUnitof pool cleaning period.setPort(int port) Set the port of the smtp server.setProxyOptions(ProxyOptions proxyOptions) Set proxy options for connections via CONNECT proxy (e.g.setReceiveBufferSize(int receiveBufferSize) Set the TCP receive buffer sizesetReconnectAttempts(int attempts) Set the value of reconnect attemptssetReconnectInterval(long interval) Set the reconnect intervalsetReuseAddress(boolean reuseAddress) Set the value of reuse addresssetReusePort(boolean reusePort) Set the value of reuse port.setSendBufferSize(int sendBufferSize) Set the TCP send buffer sizesetSoLinger(int soLinger) Set whether SO_linger keep alive is enabledsetSsl(boolean isSsl) Set whether SSL/TLS is enabledsetSslEngineOptions(SSLEngineOptions sslEngineOptions) Set to use SSL engine implementation to use.setSslHandshakeTimeout(long sslHandshakeTimeout) Set the SSL handshake timeout, default time unit is seconds.setSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit) Set the SSL handshake timeout unit.setStarttls(StartTLSOptions starttls) Set the tls security mode for the connection.setTcpCork(boolean tcpCork) Enable theTCP_CORKoption - only with linux native transport.setTcpFastOpen(boolean tcpFastOpen) Enable theTCP_FASTOPENoption - only with linux native transport.setTcpKeepAlive(boolean tcpKeepAlive) Set whether TCP keep alive is enabledsetTcpNoDelay(boolean tcpNoDelay) Set whether TCP no delay is enabledsetTcpQuickAck(boolean tcpQuickAck) Enable theTCP_QUICKACKoption - only with linux native transport.setTrafficClass(int trafficClass) Set the value of traffic classsetTrustAll(boolean trustAll) Set whether all server certificates should be trustedsetTrustOptions(TrustOptions options) Set the trust options.setUseAlpn(boolean useAlpn) Set the ALPN usage.setUserAgent(String userAgent) Sets the Mail User Agent(MUA) name.setUsername(String username) Set the username for the login.setWorkstation(String workstation) Sets the workstation used on NTLM authenticationtoJson()convert config object to Json representationMethods inherited from class NetClientOptions
addNonProxyHost, getApplicationLayerProtocols, getHostnameVerificationAlgorithm, getReconnectAttempts, getReconnectInterval, isRegisterWriteHandler, removeEnabledCipherSuite, setActivityLogDataFormat, setApplicationLayerProtocols, setNonProxyHosts, setReadIdleTimeout, setRegisterWriteHandler, setTcpUserTimeout, setWriteIdleTimeoutMethods inherited from class ClientOptionsBase
createSSLOptions, getConnectTimeout, getLocalAddress, getMetricsName, getNonProxyHosts, getOrCreateSSLOptions, getProxyOptions, getSslOptions, isTrustAllMethods inherited from class TCPSSLOptions
getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getKeyCertOptions, getReadIdleTimeout, getReceiveBufferSize, getSendBufferSize, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getTcpKeepAliveCount, getTcpKeepAliveIdleSeconds, getTcpKeepAliveIntervalSeconds, getTcpUserTimeout, getTrafficClass, getTransportOptions, getTrustOptions, getWriteIdleTimeout, isReuseAddress, isReusePort, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn, setTcpKeepAliveCount, setTcpKeepAliveIdleSeconds, setTcpKeepAliveIntervalSecondsMethods inherited from class NetworkOptions
getActivityLogDataFormat, getLogActivity
-
Field Details
-
DEFAULT_LOGIN
-
DEFAULT_TLS
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
DEFAULT_HOST
- See Also:
-
DEFAULT_MAX_POOL_SIZE
public static final int DEFAULT_MAX_POOL_SIZE- See Also:
-
DEFAULT_ALLOW_RCPT_ERRORS
public static final boolean DEFAULT_ALLOW_RCPT_ERRORS- See Also:
-
DEFAULT_KEEP_ALIVE
public static final boolean DEFAULT_KEEP_ALIVE- See Also:
-
DEFAULT_DISABLE_ESMTP
public static final boolean DEFAULT_DISABLE_ESMTP- See Also:
-
DEFAULT_USER_AGENT
- See Also:
-
DEFAULT_ENABLE_PIPELINING
public static final boolean DEFAULT_ENABLE_PIPELINING- See Also:
-
DEFAULT_MULTI_PART_ONLY
public static final boolean DEFAULT_MULTI_PART_ONLY- See Also:
-
DEFAULT_MAILS_PER_CONNECTION
public static final long DEFAULT_MAILS_PER_CONNECTION- See Also:
-
DEFAULT_POOL_CLEANER_PERIOD
public static final int DEFAULT_POOL_CLEANER_PERIODDefault pool cleaner period = 1000 ms (1 second)- See Also:
-
DEFAULT_POOL_CLEANER_PERIOD_TIMEOUT_UNIT
-
DEFAULT_KEEP_ALIVE_TIMEOUT
public static final int DEFAULT_KEEP_ALIVE_TIMEOUTThe default keep alive timeout for SMTP connection = 5 minutes- See Also:
-
DEFAULT_KEEP_ALIVE_TIMEOUT_UNIT
-
-
Constructor Details
-
MailConfig
public MailConfig()construct a config object with default options -
MailConfig
construct a config object with hostname and default options- Parameters:
hostname- the hostname of the mail server
-
MailConfig
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
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
copy config object from another MailConfig object- Parameters:
other- the object to be copied
-
MailConfig
construct config object from Json representation- Parameters:
config- the config to copy
-
-
Method Details
-
setSendBufferSize
Description copied from class:NetworkOptionsSet the TCP send buffer size- Overrides:
setSendBufferSizein classNetClientOptions- Parameters:
sendBufferSize- the buffers size, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
setReceiveBufferSize
Description copied from class:NetworkOptionsSet the TCP receive buffer size- Overrides:
setReceiveBufferSizein classNetClientOptions- Parameters:
receiveBufferSize- the buffers size, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
setReuseAddress
Description copied from class:NetworkOptionsSet the value of reuse address- Overrides:
setReuseAddressin classNetClientOptions- Parameters:
reuseAddress- the value of reuse address- Returns:
- a reference to this, so the API can be used fluently
-
setReusePort
Description copied from class:NetworkOptionsSet the value of reuse port. This is only supported by native transports.- Overrides:
setReusePortin classNetClientOptions- Parameters:
reusePort- the value of reuse port- Returns:
- a reference to this, so the API can be used fluently
-
setTrafficClass
Description copied from class:NetworkOptionsSet the value of traffic class- Overrides:
setTrafficClassin classNetClientOptions- Parameters:
trafficClass- the value of traffic class- Returns:
- a reference to this, so the API can be used fluently
-
setTcpNoDelay
Description copied from class:TCPSSLOptionsSet whether TCP no delay is enabled- Overrides:
setTcpNoDelayin classNetClientOptions- Parameters:
tcpNoDelay- true if TCP no delay is enabled (Nagle disabled)- Returns:
- a reference to this, so the API can be used fluently
-
setTcpKeepAlive
Description copied from class:TCPSSLOptionsSet whether TCP keep alive is enabled- Overrides:
setTcpKeepAlivein classNetClientOptions- Parameters:
tcpKeepAlive- true if TCP keep alive is enabled- Returns:
- a reference to this, so the API can be used fluently
-
setSoLinger
Description copied from class:TCPSSLOptionsSet whether SO_linger keep alive is enabled- Overrides:
setSoLingerin classNetClientOptions- Parameters:
soLinger- true if SO_linger is enabled- Returns:
- a reference to this, so the API can be used fluently
-
setIdleTimeout
Description copied from class:TCPSSLOptionsSet the idle timeout, default time unit is seconds. Zero means don't timeout. This determines if a connection will timeout and be closed if no data is received nor sent within the timeout. If you want change default time unit, useTCPSSLOptions.setIdleTimeoutUnit(TimeUnit)- Overrides:
setIdleTimeoutin classNetClientOptions- Parameters:
idleTimeout- the timeout- Returns:
- a reference to this, so the API can be used fluently
-
setIdleTimeoutUnit
Description copied from class:TCPSSLOptionsSet the idle timeout unit. If not specified, default is seconds.- Overrides:
setIdleTimeoutUnitin classNetClientOptions- Parameters:
idleTimeoutUnit- specify time unit.- Returns:
- a reference to this, so the API can be used fluently
-
setKeyCertOptions
Description copied from class:TCPSSLOptionsSet the key/cert options.- Overrides:
setKeyCertOptionsin classNetClientOptions- Parameters:
options- the key store options- Returns:
- a reference to this, so the API can be used fluently
-
setTrustOptions
Description copied from class:TCPSSLOptionsSet the trust options.- Overrides:
setTrustOptionsin classNetClientOptions- Parameters:
options- the trust options- Returns:
- a reference to this, so the API can be used fluently
-
addEnabledCipherSuite
Description copied from class:TCPSSLOptionsAdd an enabled cipher suite, appended to the ordered suites.- Overrides:
addEnabledCipherSuitein classNetClientOptions- Parameters:
suite- the suite- Returns:
- a reference to this, so the API can be used fluently
- See Also:
-
addEnabledSecureTransportProtocol
Description copied from class:TCPSSLOptionsAdd an enabled SSL/TLS protocols, appended to the ordered protocols.- Overrides:
addEnabledSecureTransportProtocolin classNetClientOptions- Parameters:
protocol- the SSL/TLS protocol to enable- Returns:
- a reference to this, so the API can be used fluently
-
removeEnabledSecureTransportProtocol
Description copied from class:TCPSSLOptionsRemoves an enabled SSL/TLS protocol from the ordered protocols.- Overrides:
removeEnabledSecureTransportProtocolin classNetClientOptions- Parameters:
protocol- the SSL/TLS protocol to disable- Returns:
- a reference to this, so the API can be used fluently
-
setUseAlpn
Description copied from class:TCPSSLOptionsSet the ALPN usage.- Overrides:
setUseAlpnin classNetClientOptions- Parameters:
useAlpn- true when Application-Layer Protocol Negotiation should be used
-
setSslEngineOptions
Description copied from class:TCPSSLOptionsSet to use SSL engine implementation to use.- Overrides:
setSslEngineOptionsin classNetClientOptions- Parameters:
sslEngineOptions- the ssl engine to use- Returns:
- a reference to this, so the API can be used fluently
-
setTcpFastOpen
Description copied from class:TCPSSLOptionsEnable theTCP_FASTOPENoption - only with linux native transport.- Overrides:
setTcpFastOpenin classNetClientOptions- Parameters:
tcpFastOpen- the fast open value
-
setTcpCork
Description copied from class:TCPSSLOptionsEnable theTCP_CORKoption - only with linux native transport.- Overrides:
setTcpCorkin classNetClientOptions- Parameters:
tcpCork- the cork value
-
setTcpQuickAck
Description copied from class:TCPSSLOptionsEnable theTCP_QUICKACKoption - only with linux native transport.- Overrides:
setTcpQuickAckin classNetClientOptions- Parameters:
tcpQuickAck- the quick ack value
-
addCrlPath
Description copied from class:TCPSSLOptionsAdd a CRL path- Overrides:
addCrlPathin classNetClientOptions- Parameters:
crlPath- the path- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
addCrlValue
Description copied from class:TCPSSLOptionsAdd a CRL value- Overrides:
addCrlValuein classNetClientOptions- Parameters:
crlValue- the value- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
setConnectTimeout
Description copied from class:ClientOptionsBaseSet the connect timeout- Overrides:
setConnectTimeoutin classNetClientOptions- Parameters:
connectTimeout- connect timeout, in ms- Returns:
- a reference to this, so the API can be used fluently
-
setMetricsName
Description copied from class:ClientOptionsBaseSet the metrics name identifying the reported metrics, useful for grouping metrics with the same name.- Overrides:
setMetricsNamein classNetClientOptions- Parameters:
metricsName- the metrics name- Returns:
- a reference to this, so the API can be used fluently
-
setReconnectAttempts
Description copied from class:NetClientOptionsSet the value of reconnect attempts- Overrides:
setReconnectAttemptsin classNetClientOptions- Parameters:
attempts- the maximum number of reconnect attempts- Returns:
- a reference to this, so the API can be used fluently
-
setReconnectInterval
Description copied from class:NetClientOptionsSet the reconnect interval- Overrides:
setReconnectIntervalin classNetClientOptions- Parameters:
interval- the reconnect interval in ms- Returns:
- a reference to this, so the API can be used fluently
-
setHostnameVerificationAlgorithm
Description copied from class:NetClientOptionsSet the hostname verification algorithm interval To disable hostname verification, set hostnameVerificationAlgorithm to an empty String- Overrides:
setHostnameVerificationAlgorithmin classNetClientOptions- Parameters:
hostnameVerificationAlgorithm- should be HTTPS, LDAPS or an empty String- Returns:
- a reference to this, so the API can be used fluently
-
setLogActivity
Description copied from class:NetworkOptionsSet to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.- Overrides:
setLogActivityin classNetClientOptions- Parameters:
logEnabled- true for logging the network activity- Returns:
- a reference to this, so the API can be used fluently
-
setProxyOptions
Description copied from class:ClientOptionsBaseSet proxy options for connections via CONNECT proxy (e.g. Squid) or a SOCKS proxy.- Overrides:
setProxyOptionsin classNetClientOptions- Parameters:
proxyOptions- proxy options object- Returns:
- a reference to this, so the API can be used fluently
-
setLocalAddress
Description copied from class:ClientOptionsBaseSet the local interface to bind for network connections. When the local address is null, it will pick any local address, the default local address is null.- Overrides:
setLocalAddressin classNetClientOptions- Parameters:
localAddress- the local address- Returns:
- a reference to this, so the API can be used fluently
-
setSslHandshakeTimeout
Description copied from class:TCPSSLOptionsSet the SSL handshake timeout, default time unit is seconds.- Overrides:
setSslHandshakeTimeoutin classNetClientOptions- Parameters:
sslHandshakeTimeout- the SSL handshake timeout to set, in milliseconds- Returns:
- a reference to this, so the API can be used fluently
-
setSslHandshakeTimeoutUnit
Description copied from class:TCPSSLOptionsSet the SSL handshake timeout unit. If not specified, default is seconds.- Overrides:
setSslHandshakeTimeoutUnitin classNetClientOptions- Parameters:
sslHandshakeTimeoutUnit- specify time unit.- Returns:
- a reference to this, so the API can be used fluently
-
getHostname
-
setHostname
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
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
-
setStarttls
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
-
setLogin
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
-
setUsername
Set the username for the login.- Parameters:
username- the username- Returns:
- a reference to this, so the API can be used fluently
-
getPassword
-
setPassword
Set the password for the login.- Parameters:
password- the password- Returns:
- a reference to this, so the API can be used fluently
-
setSsl
Description copied from class:TCPSSLOptionsSet whether SSL/TLS is enabled- Overrides:
setSslin classNetClientOptions- Parameters:
isSsl- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
setEnabledSecureTransportProtocols
Description copied from class:TCPSSLOptionsSets the list of enabled SSL/TLS protocols.- Overrides:
setEnabledSecureTransportProtocolsin classNetClientOptions- Parameters:
enabledSecureTransportProtocols- the SSL/TLS protocols to enable- Returns:
- a reference to this, so the API can be used fluently
-
setTrustAll
Description copied from class:ClientOptionsBaseSet whether all server certificates should be trusted- Overrides:
setTrustAllin classNetClientOptions- Parameters:
trustAll- true if all should be trusted- Returns:
- a reference to this, so the API can be used fluently
-
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
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
get the hostname to be used for HELO/EHLO and the Message-ID- Returns:
- my own hostname
-
setOwnHostname
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
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
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
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
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
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
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
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
-
addDKIMSignOption
Adds a DKIMSignOptions.- Parameters:
dkimSignOptions- the DKIMSignOptions- Returns:
- this to be able to use the object fluently
-
setDKIMSignOptions
Sets DKIMSignOptions.- Parameters:
dkimSignOptions- the DKIM options- Returns:
- this to be able to use the object fluently
-
setDKIMSignOption
Sets one DKIMSignOptions for convenient.- Parameters:
dkimSignOptions- the DKIM options- Returns:
- this to be able to use the object fluently
-
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
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
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
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
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
Gets theTimeUnitof pool cleaning period. Defaults toTimeUnit.MILLISECONDS- Returns:
- the
TimeUnitof the pool cleaning period.
-
setPoolCleanerPeriodUnit
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
Gets theTimeUnitof keeping the connections alive timeout. Defaults toTimeUnit.SECONDS- Returns:
- the
TimeUnitof keeping the connections alive timeout
-
setKeepAliveTimeoutUnit
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
Domain used on NTLM authentication.- Returns:
- the domain name used on NTLM authentication
-
setNtDomain
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
Workstation used on NTLM authentication- Returns:
- the workstation used on NTLM authentication
-
setWorkstation
Sets the workstation used on NTLM authentication- Parameters:
workstation- the workstation- Returns:
- a reference to this, so the API can be used fluently
-
setMaxMailsPerConnection
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
convert config object to Json representation- Overrides:
toJsonin classNetClientOptions- Returns:
- json object of the config
-
equals
-
hashCode
-