public enum TransportStrategy extends Enum<TransportStrategy>
Session may be configured using a
TransportStrategy implementation.| Enum Constant and Description |
|---|
SMTP_PLAIN
Simplest possible form: only vanilla ".smtp." property names and no extra properties.
|
SMTP_SSL
SMTPS / SSL transport strategy, that returns the ".smtps." variation of the SMTP_PLAIN version.
|
SMTP_TLS
NOTE: this code is in untested beta state
|
| Modifier and Type | Method and Description |
|---|---|
static TransportStrategy |
findStrategyForSession(javax.mail.Session session) |
Properties |
generateProperties()
Base implementation that simply returns an empty list of properties and a marker for the specific current strategy.
|
abstract String |
propertyNameAuthenticate() |
abstract String |
propertyNameHost() |
abstract String |
propertyNamePort() |
abstract String |
propertyNameUsername() |
String |
toString(Properties properties) |
static TransportStrategy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static TransportStrategy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final TransportStrategy SMTP_PLAIN
public static final TransportStrategy SMTP_SSL
javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLException: Unsupported record version Unknown-50.49
(..)
The mail is sent but the exception is unwanted. The property quitwait means If set to false, the QUIT command is sent and the connection is immediately closed. If set to true (the default), causes the transport to wait for the response to the QUIT command
public static final TransportStrategy SMTP_TLS
Uses standard ".smtp." property names (like SMTP_PLAIN). Additionally the transport protocol is explicitly set to
smtp. Finally, the property "mail.smtp.starttls.enable" is being set to true.
public static TransportStrategy[] values()
for (TransportStrategy c : TransportStrategy.values()) System.out.println(c);
public static TransportStrategy valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic Properties generateProperties()
Should be overridden by the various strategies where appropriate.
Properties instance.public abstract String propertyNameHost()
public abstract String propertyNamePort()
public abstract String propertyNameUsername()
public abstract String propertyNameAuthenticate()
public static TransportStrategy findStrategyForSession(javax.mail.Session session)
session - The session to determine the current transport strategy forgenerateProperties()public String toString(Properties properties)
Copyright © 2017. All rights reserved.