Class EmailFactory

java.lang.Object
org.graylog2.shared.email.EmailFactory

@Singleton public class EmailFactory extends Object
Utility class to create preconfigured Email instances by applying the settings from EmailConfiguration.
  • Constructor Details

  • Method Details

    • isEmailTransportEnabled

      public boolean isEmailTransportEnabled()
    • simpleEmail

      public org.apache.commons.mail.SimpleEmail simpleEmail() throws org.apache.commons.mail.EmailException
      Creates a preconfigured SimpleEmail object with the settings from EmailConfiguration applied.
      Throws:
      org.apache.commons.mail.EmailException - If applying configuration values fails.
    • multiPartEmail

      public org.apache.commons.mail.MultiPartEmail multiPartEmail() throws org.apache.commons.mail.EmailException
      Creates a preconfigured MultiPartEmail object with the settings from EmailConfiguration applied.
      Throws:
      org.apache.commons.mail.EmailException - If applying configuration values fails.
    • htmlEmail

      public org.apache.commons.mail.HtmlEmail htmlEmail() throws org.apache.commons.mail.EmailException
      Creates a preconfigured HtmlEmail object with the settings from EmailConfiguration applied.
      Throws:
      org.apache.commons.mail.EmailException - If applying configuration values fails.
    • imageHtmlEmail

      public org.apache.commons.mail.ImageHtmlEmail imageHtmlEmail() throws org.apache.commons.mail.EmailException
      Creates a preconfigured ImageHtmlEmail object with the settings from EmailConfiguration applied.
      Throws:
      org.apache.commons.mail.EmailException - If applying configuration values fails.
    • getPreconfigured

      public <T extends org.apache.commons.mail.Email> T getPreconfigured(Supplier<T> objectSupplier) throws org.apache.commons.mail.EmailException
      Creates a preconfigured Email object with the settings from EmailConfiguration applied.
      Parameters:
      objectSupplier - Supplier to create a raw object of the appropriate subtype of Email
      Throws:
      org.apache.commons.mail.EmailException - If applying configuration values fails.