Class MailerBuilder

java.lang.Object
org.simplejavamail.mailer.MailerBuilder

public class MailerBuilder extends Object
Entry builder used to start a MailerGenericBuilder and fully configure a Mailer.

Any of these methods return a specialized builder, of which there are two:

  • One to configure a Mailer using a custom Session instance
  • One to fully configure a Mailer which will produce its own Session instance
See Also:
  • MailerFromSessionBuilderImpl
  • MailerRegularBuilderImpl
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.simplejavamail.api.mailer.Mailer
    Shortcuts to MailerRegularBuilder.buildMailer().
    static org.simplejavamail.mailer.internal.MailerFromSessionBuilderImpl
    usingSession(@NotNull jakarta.mail.Session session)
    Delegates to MailerFromSessionBuilderImpl.usingSession(Session).
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withCustomMailer(org.simplejavamail.api.mailer.CustomMailer customMailer)
    Delegates to MailerGenericBuilder.withCustomMailer(CustomMailer).
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withDebugLogging(Boolean debugLogging)
    Delegates to MailerGenericBuilder.withDebugLogging(Boolean)
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withDebugOutput(org.simplejavamail.api.mailer.config.SessionDebugOutput debugOutput)
    Delegates to MailerGenericBuilder.withDebugOutput(SessionDebugOutput)
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    Delegates to MailerGenericBuilder.withDebugPrinter(PrintStream)
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withOAuth2AccessTokenProvider(@NotNull org.simplejavamail.api.mailer.config.OAuth2AccessTokenProvider accessTokenProvider)
    Delegates to MailerGenericBuilder.withOAuth2AccessTokenProvider(OAuth2AccessTokenProvider).
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withSMTPServer(@Nullable String host, @Nullable Integer port)
    Delegates to MailerRegularBuilder.withSMTPServer(String, Integer).
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withSMTPServer(@Nullable String host, @Nullable Integer port, @Nullable String username)
    Delegates to MailerRegularBuilder.withSMTPServer(String, Integer, String).
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withSMTPServer(@Nullable String host, @Nullable Integer port, @Nullable String username, @Nullable String password)
    Delegates to MailerRegularBuilder.withSMTPServer(String, Integer, String, String).
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withSMTPServerHost(@Nullable String host)
    Delegates to MailerRegularBuilder.withSMTPServerHost(String).
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withSMTPServerPassword(@Nullable String password)
    Delegates to MailerRegularBuilder.withSMTPServerPassword(String).
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withSMTPServerPort(@Nullable Integer port)
    Delegates to MailerRegularBuilder.withSMTPServerPort(Integer).
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withSMTPServerUsername(@Nullable String username)
    Delegates to MailerRegularBuilder.withSMTPServerUsername(String).
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    Delegates to MailerGenericBuilder.withTransportModeLoggingOnly(Boolean).
    static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl
    withTransportStrategy(@NotNull org.simplejavamail.api.mailer.config.TransportStrategy transportStrategy)
    Delegates to MailerRegularBuilder.withTransportStrategy(TransportStrategy).

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • usingSession

      public static org.simplejavamail.mailer.internal.MailerFromSessionBuilderImpl usingSession(@NotNull @NotNull jakarta.mail.Session session)
      Delegates to MailerFromSessionBuilderImpl.usingSession(Session).
    • withTransportStrategy

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withTransportStrategy(@NotNull @NotNull org.simplejavamail.api.mailer.config.TransportStrategy transportStrategy)
      Delegates to MailerRegularBuilder.withTransportStrategy(TransportStrategy).
    • withOAuth2AccessTokenProvider

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withOAuth2AccessTokenProvider(@NotNull @NotNull org.simplejavamail.api.mailer.config.OAuth2AccessTokenProvider accessTokenProvider)
      Delegates to MailerGenericBuilder.withOAuth2AccessTokenProvider(OAuth2AccessTokenProvider).
    • withSMTPServer

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withSMTPServer(@Nullable @Nullable String host, @Nullable @Nullable Integer port, @Nullable @Nullable String username, @Nullable @Nullable String password)
      Delegates to MailerRegularBuilder.withSMTPServer(String, Integer, String, String).
    • withSMTPServer

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withSMTPServer(@Nullable @Nullable String host, @Nullable @Nullable Integer port, @Nullable @Nullable String username)
      Delegates to MailerRegularBuilder.withSMTPServer(String, Integer, String).
    • withSMTPServer

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withSMTPServer(@Nullable @Nullable String host, @Nullable @Nullable Integer port)
      Delegates to MailerRegularBuilder.withSMTPServer(String, Integer).
    • withSMTPServerHost

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withSMTPServerHost(@Nullable @Nullable String host)
      Delegates to MailerRegularBuilder.withSMTPServerHost(String).
    • withSMTPServerPort

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withSMTPServerPort(@Nullable @Nullable Integer port)
      Delegates to MailerRegularBuilder.withSMTPServerPort(Integer).
    • withSMTPServerUsername

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withSMTPServerUsername(@Nullable @Nullable String username)
      Delegates to MailerRegularBuilder.withSMTPServerUsername(String).
    • withSMTPServerPassword

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withSMTPServerPassword(@Nullable @Nullable String password)
      Delegates to MailerRegularBuilder.withSMTPServerPassword(String).
    • withDebugLogging

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withDebugLogging(Boolean debugLogging)
      Delegates to MailerGenericBuilder.withDebugLogging(Boolean)

      Note: Assumes you don't want to use your own Session object (otherwise start with usingSession(Session) instead).

    • withDebugPrinter

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withDebugPrinter(PrintStream debugPrinter)
      Delegates to MailerGenericBuilder.withDebugPrinter(PrintStream)

      Note: Assumes you don't want to use your own Session object (otherwise start with usingSession(Session) instead).

    • withDebugOutput

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withDebugOutput(org.simplejavamail.api.mailer.config.SessionDebugOutput debugOutput)
      Delegates to MailerGenericBuilder.withDebugOutput(SessionDebugOutput)

      Note: Assumes you don't want to use your own Session object (otherwise start with usingSession(Session) instead).

    • withCustomMailer

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withCustomMailer(org.simplejavamail.api.mailer.CustomMailer customMailer)
      Delegates to MailerGenericBuilder.withCustomMailer(CustomMailer).
    • withTransportModeLoggingOnly

      public static org.simplejavamail.mailer.internal.MailerRegularBuilderImpl withTransportModeLoggingOnly()
      Delegates to MailerGenericBuilder.withTransportModeLoggingOnly(Boolean).
    • buildMailer

      public static org.simplejavamail.api.mailer.Mailer buildMailer()
      Shortcuts to MailerRegularBuilder.buildMailer(). This means that none of the builder methods are used and the configuration completely depends on defaults being configured from property file ("simplejavamail.properties") on the classpath or through programmatic defaults.