Package org.graylog2.shared.email
Class EmailFactory
java.lang.Object
org.graylog2.shared.email.EmailFactory
Utility class to create preconfigured
Email
instances by applying the settings from
EmailConfiguration
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends org.apache.commons.mail.Email>
TgetPreconfigured
(Supplier<T> objectSupplier) Creates a preconfiguredEmail
object with the settings fromEmailConfiguration
applied.org.apache.commons.mail.HtmlEmail
Creates a preconfiguredHtmlEmail
object with the settings fromEmailConfiguration
applied.org.apache.commons.mail.ImageHtmlEmail
Creates a preconfiguredImageHtmlEmail
object with the settings fromEmailConfiguration
applied.boolean
org.apache.commons.mail.MultiPartEmail
Creates a preconfiguredMultiPartEmail
object with the settings fromEmailConfiguration
applied.org.apache.commons.mail.SimpleEmail
Creates a preconfiguredSimpleEmail
object with the settings fromEmailConfiguration
applied.
-
Constructor Details
-
EmailFactory
-
-
Method Details
-
isEmailTransportEnabled
public boolean isEmailTransportEnabled() -
simpleEmail
public org.apache.commons.mail.SimpleEmail simpleEmail() throws org.apache.commons.mail.EmailExceptionCreates a preconfiguredSimpleEmail
object with the settings fromEmailConfiguration
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.EmailExceptionCreates a preconfiguredMultiPartEmail
object with the settings fromEmailConfiguration
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.EmailExceptionCreates a preconfiguredHtmlEmail
object with the settings fromEmailConfiguration
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.EmailExceptionCreates a preconfiguredImageHtmlEmail
object with the settings fromEmailConfiguration
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 preconfiguredEmail
object with the settings fromEmailConfiguration
applied.- Parameters:
objectSupplier
- Supplier to create a raw object of the appropriate subtype ofEmail
- Throws:
org.apache.commons.mail.EmailException
- If applying configuration values fails.
-