public interface MailerRegularBuilder<T extends MailerRegularBuilder<?>> extends MailerGenericBuilder<T>
Note: To start creating a new Mailer, you use MailerBuilder
directly instead.
Note: Any builder methods invoked after this will override the default value.
In addition on generic Mailer setting, this builder is used to configure SMTP server details and transport strategy needed to produce a valid
Session
instance.
TransportStrategy
DEFAULT_CONNECTIONPOOL_CLAIMTIMEOUT_MILLIS, DEFAULT_CONNECTIONPOOL_CORE_SIZE, DEFAULT_CONNECTIONPOOL_EXPIREAFTER_MILLIS, DEFAULT_CONNECTIONPOOL_LOADBALANCING_STRATEGY, DEFAULT_CONNECTIONPOOL_MAX_SIZE, DEFAULT_JAVAXMAIL_DEBUG, DEFAULT_POOL_KEEP_ALIVE_TIME, DEFAULT_POOL_SIZE, DEFAULT_PROXY_BRIDGE_PORT, DEFAULT_PROXY_PORT, DEFAULT_SESSION_TIMEOUT_MILLIS, DEFAULT_TRANSPORT_MODE_LOGGING_ONLY, DEFAULT_TRUST_ALL_HOSTS, DEFAULT_VERIFY_SERVER_IDENTITY
Modifier and Type | Method and Description |
---|---|
Mailer |
buildMailer()
Builds the actual
Mailer instance with everything configured on this builder instance. |
@Nullable String |
getCustomSSLFactory() |
@Nullable String |
getHost() |
@Nullable String |
getPassword() |
@Nullable Integer |
getPort() |
@Nullable TransportStrategy |
getTransportStrategy() |
@Nullable String |
getUsername() |
T |
withCustomSSLFactoryClass(@Nullable String factoryClass)
Configures the session with the right property to use your own factory for obtaining SSL connections.
|
T |
withCustomSSLFactoryInstance(@Nullable SSLSocketFactory sslSocketFactoryInstance)
Configures the session with the right property to use your own factory for obtaining SSL connections.
|
T |
withSMTPServer(@Nullable String host,
@Nullable Integer port)
Delegates to
withSMTPServerHost(String) and withSMTPServerPort(Integer) . |
T |
withSMTPServer(@Nullable String host,
@Nullable Integer port,
@Nullable String username)
Delegates to
withSMTPServerHost(String) , withSMTPServerPort(Integer) and withSMTPServerUsername(String) . |
T |
withSMTPServer(@Nullable String host,
@Nullable Integer port,
@Nullable String username,
@Nullable String password)
|
T |
withSMTPServerHost(@Nullable String host)
Sets the optional SMTP host.
|
T |
withSMTPServerPassword(@Nullable String password)
Sets the optional SMTP password.
|
T |
withSMTPServerPort(@Nullable Integer port)
Sets the optional SMTP port.
|
T |
withSMTPServerUsername(@Nullable String username)
Sets the optional SMTP username.
|
T |
withTransportStrategy(@NotNull TransportStrategy transportStrategy)
To learn more about the various transport modes, the properties they set and the security
implications, please refer to the full TransportStrategy
javadoc. |
async, clearEmailValidator, clearProperties, clearProxy, clearSignByDefaultWithSmime, clearTrustedSSLHosts, getClusterKey, getConnectionPoolClaimTimeoutMillis, getConnectionPoolCoreSize, getConnectionPoolExpireAfterMillis, getConnectionPoolLoadBalancingStrategy, getConnectionPoolMaxSize, getCustomMailer, getEmailValidator, getExecutorService, getPkcs12ConfigForSmimeSigning, getProperties, getProxyBridgePort, getProxyHost, getProxyPassword, getProxyPort, getProxyUsername, getSessionTimeout, getSslHostsToTrust, getThreadPoolKeepAliveTime, getThreadPoolSize, isAsync, isDebugLogging, isTransportModeLoggingOnly, isTrustAllSSLHost, isVerifyingServerIdentity, resetClusterKey, resetConnectionPoolClaimTimeoutMillis, resetConnectionPoolCoreSize, resetConnectionPoolExpireAfterMillis, resetConnectionPoolLoadBalancingStrategy, resetConnectionPoolMaxSize, resetEmailValidator, resetExecutorService, resetSessionTimeout, resetThreadPoolKeepAliveTime, resetThreadPoolSize, resetTransportModeLoggingOnly, resetTrustingAllHosts, resetVerifyingServerIdentity, signByDefaultWithSmime, signByDefaultWithSmime, signByDefaultWithSmime, signByDefaultWithSmime, trustingAllHosts, trustingSSLHosts, verifyingServerIdentity, withClusterKey, withConnectionPoolClaimTimeoutMillis, withConnectionPoolCoreSize, withConnectionPoolExpireAfterMillis, withConnectionPoolLoadBalancingStrategy, withConnectionPoolMaxSize, withCustomMailer, withDebugLogging, withEmailValidator, withExecutorService, withProperties, withProperties, withProperty, withProxy, withProxy, withProxyBridgePort, withProxyHost, withProxyPassword, withProxyPort, withProxyUsername, withSessionTimeout, withThreadPoolKeepAliveTime, withThreadPoolSize, withTransportModeLoggingOnly
T withTransportStrategy(@NotNull @NotNull TransportStrategy transportStrategy)
Note: if no server port has been set, a default will be taken based on the transport strategy, since every different connection type uses a different default port.
transportStrategy
- The name of the transport strategy to use: TransportStrategy.SMTP
, TransportStrategy.SMTPS
or
TransportStrategy.SMTP_TLS
. Defaults to TransportStrategy.SMTP
.T withSMTPServer(@Nullable @Nullable String host, @Nullable @Nullable Integer port, @Nullable @Nullable String username, @Nullable @Nullable String password)
withSMTPServerHost(String)
, withSMTPServerPort(Integer)
, withSMTPServerUsername(String)
and withSMTPServerPassword(String)
.host
- Optional host that defaults to pre-configured property if left empty.port
- Optional port number that defaults to pre-configured property if left empty.username
- Optional username that defaults to pre-configured property if left empty.password
- Optional password that defaults to pre-configured property if left empty.T withSMTPServer(@Nullable @Nullable String host, @Nullable @Nullable Integer port, @Nullable @Nullable String username)
withSMTPServerHost(String)
, withSMTPServerPort(Integer)
and withSMTPServerUsername(String)
.host
- Optional host that defaults to pre-configured property if left empty.port
- Optional port number that defaults to pre-configured property if left empty.username
- Optional username that defaults to pre-configured property if left empty.T withSMTPServer(@Nullable @Nullable String host, @Nullable @Nullable Integer port)
withSMTPServerHost(String)
and withSMTPServerPort(Integer)
.host
- Optional host that defaults to pre-configured property if left empty.port
- Optional port number that defaults to pre-configured property if left empty.T withSMTPServerHost(@Nullable @Nullable String host)
host
- Optional host that defaults to pre-configured property if left empty.T withSMTPServerPort(@Nullable @Nullable Integer port)
port
- Optional port number that defaults to pre-configured property if left empty.T withSMTPServerUsername(@Nullable @Nullable String username)
username
- Optional username that defaults to pre-configured property if left empty.T withSMTPServerPassword(@Nullable @Nullable String password)
password
- Optional password that defaults to pre-configured property if left empty.T withCustomSSLFactoryClass(@Nullable @Nullable String factoryClass)
Note 1: Is overridden by custom factory instance if set.
Note 2: Sets the property mail.smtp.ssl.socketFactory.class
on the Session.
Note 3: This breaks your setup if you also use authenticated proxy.
factoryClass
- The fully qualified name of the factory class. Example: javax.net.ssl.SSLSocketFactory
withCustomSSLFactoryInstance(SSLSocketFactory)
T withCustomSSLFactoryInstance(@Nullable @Nullable SSLSocketFactory sslSocketFactoryInstance)
Note 1: Overrides custom factory class if set.
Note 2: Sets the property mail.smtp.ssl.socketFactory
on the Session.
Note 3: This breaks your setup if you also use authenticated proxy.
sslSocketFactoryInstance
- An instance of the SSLSocketFactory
class.withCustomSSLFactoryClass(String)
Mailer buildMailer()
Mailer
instance with everything configured on this builder instance.
For all configurable values: if omitted, a default value will be attempted by looking at property files or manually defined defauls.
buildMailer
in interface MailerGenericBuilder<T extends MailerRegularBuilder<?>>
@Nullable @Nullable String getHost()
withSMTPServerHost(String)
@Nullable @Nullable Integer getPort()
withSMTPServerPort(Integer)
@Nullable @Nullable String getUsername()
withSMTPServerUsername(String)
@Nullable @Nullable String getPassword()
withSMTPServerPassword(String)
@Nullable @Nullable TransportStrategy getTransportStrategy()
withTransportStrategy(TransportStrategy)
@Nullable @Nullable String getCustomSSLFactory()
withCustomSSLFactoryClass(String)
Copyright © 2009–2022. All rights reserved.