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
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends org.apache.commons.mail.Email>
TgetPreconfigured(Supplier<T> objectSupplier) Creates a preconfiguredEmailobject with the settings fromEmailConfigurationapplied.org.apache.commons.mail.HtmlEmailCreates a preconfiguredHtmlEmailobject with the settings fromEmailConfigurationapplied.org.apache.commons.mail.ImageHtmlEmailCreates a preconfiguredImageHtmlEmailobject with the settings fromEmailConfigurationapplied.booleanorg.apache.commons.mail.MultiPartEmailCreates a preconfiguredMultiPartEmailobject with the settings fromEmailConfigurationapplied.org.apache.commons.mail.SimpleEmailCreates a preconfiguredSimpleEmailobject with the settings fromEmailConfigurationapplied.
-
Constructor Details
-
EmailFactory
-
-
Method Details
-
isEmailTransportEnabled
public boolean isEmailTransportEnabled() -
simpleEmail
public org.apache.commons.mail.SimpleEmail simpleEmail() throws org.apache.commons.mail.EmailExceptionCreates a preconfiguredSimpleEmailobject with the settings fromEmailConfigurationapplied.- 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 preconfiguredMultiPartEmailobject with the settings fromEmailConfigurationapplied.- 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 preconfiguredHtmlEmailobject with the settings fromEmailConfigurationapplied.- 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 preconfiguredImageHtmlEmailobject with the settings fromEmailConfigurationapplied.- 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 preconfiguredEmailobject with the settings fromEmailConfigurationapplied.- Parameters:
objectSupplier- Supplier to create a raw object of the appropriate subtype ofEmail- Throws:
org.apache.commons.mail.EmailException- If applying configuration values fails.
-