Class MailTransport

java.lang.Object
com.atlassian.crowd.manager.mail.transport.MailTransport
Direct Known Subclasses:
BasicAuthenticationMailTransport, JndiMailTransport, NoAuthenticationMailTransport, OAuth2MailTransport

public abstract class MailTransport extends Object
A wrapper around the JavaMail Transport class that handles the creation/closing of the Session.
  • Field Details

    • FORMAT_MAILER_SMTP_HOST

      protected static String FORMAT_MAILER_SMTP_HOST
    • FORMAT_MAILER_SMTP_PORT

      protected static String FORMAT_MAILER_SMTP_PORT
    • FORMAT_MAILER_SMTP_AUTH

      protected static String FORMAT_MAILER_SMTP_AUTH
    • FORMAT_MAILER_SMTP_TIMEOUT

      protected static String FORMAT_MAILER_SMTP_TIMEOUT
    • FORMAT_MAILER_SMTP_CONNECTIONTIMEOUT

      protected static String FORMAT_MAILER_SMTP_CONNECTIONTIMEOUT
    • FORMAT_MAILER_SMTP_STARTTLS_ENABLE

      protected static String FORMAT_MAILER_SMTP_STARTTLS_ENABLE
    • FORMAT_MAILER_SMTP_CHECKSERVERIDENTITY

      protected static String FORMAT_MAILER_SMTP_CHECKSERVERIDENTITY
    • FORMAT_MAILER_AUTH_MECHANISMS

      protected static String FORMAT_MAILER_AUTH_MECHANISMS
    • XOAUTH2

      protected static String XOAUTH2
  • Constructor Details

    • MailTransport

      public MailTransport()
  • Method Details

    • connectAndExecuteCallback

      public abstract <T> T connectAndExecuteCallback(@Nonnull BiFunction<javax.mail.Transport,MailSessionWrapper,T> callback, @Nonnull SMTPServer smtpServer, PrintStream debugStream) throws MailSendException
      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

      protected Properties getCommonSessionProperties(@Nonnull SMTPServer smtpServer)
    • getProtocol

      protected String getProtocol(SMTPServer smtpServer)