Class MailTransport
java.lang.Object
com.atlassian.crowd.manager.mail.transport.MailTransport
- Direct Known Subclasses:
BasicAuthenticationMailTransport
,JndiMailTransport
,NoAuthenticationMailTransport
,OAuth2MailTransport
A wrapper around the JavaMail
Transport
class that handles the creation/closing of the Session
.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract <T> T
connectAndExecuteCallback
(BiFunction<javax.mail.Transport, MailSessionWrapper, T> callback, SMTPServer smtpServer, PrintStream debugStream) Opens a connection to an SMTP server, executes a callback and closes the connection.protected Properties
getCommonSessionProperties
(SMTPServer smtpServer) protected String
getProtocol
(SMTPServer smtpServer)
-
Field Details
-
FORMAT_MAILER_SMTP_HOST
-
FORMAT_MAILER_SMTP_PORT
-
FORMAT_MAILER_SMTP_AUTH
-
FORMAT_MAILER_SMTP_TIMEOUT
-
FORMAT_MAILER_SMTP_CONNECTIONTIMEOUT
-
FORMAT_MAILER_SMTP_STARTTLS_ENABLE
-
FORMAT_MAILER_SMTP_CHECKSERVERIDENTITY
-
FORMAT_MAILER_AUTH_MECHANISMS
-
XOAUTH2
-
-
Constructor Details
-
MailTransport
public MailTransport()
-
-
Method Details
-
connectAndExecuteCallback
public abstract <T> T connectAndExecuteCallback(@Nonnull BiFunction<javax.mail.Transport, MailSessionWrapper, throws MailSendExceptionT> callback, @Nonnull SMTPServer smtpServer, PrintStream debugStream) Opens a connection to an SMTP server, executes a callback and closes the connection.- Type Parameters:
T
- type of the value returned by the callback.- Parameters:
callback
- executed after opening the connection to the SMTP server.smtpServer
- SMTP server configuration which is used to determine the host, port and other connection parameters.debugStream
- PrintStream to output debug information to. Can be null.- Returns:
- return value of the callback.
- Throws:
MailSendException
- if a connection to the SMTP server cannot be established.
-
getCommonSessionProperties
-
getProtocol
-