Interface MailHandler
-
public interface MailHandlerA service that sends e-mails.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringapplyTemplate(ApplyMailTemplateParams params)Applies the configured e-mail template.MailProcessingContextcreateMailProcessingContext(String toName, String toEmail, String subject, String body, ConfigurationAccessor configurationAccessor, FileInfo... attachments)Returns the context for sending an e-mail with the given information.JavaMailSendergetMailSender()Returns a JavaMailSender for the current configurationJavaMailSendergetMailSender(Configuration configuration)Returns a JavaMailSender for the given configurationJavaMailSendergetMailSender(ConfigurationAccessor configuration)Returns a JavaMailSender for the given configuration accessorList<ParameterVO>getMailTemplateVariables()Returns the list of available variables applied to email templates.MailProcessingContextpreview(BasicUser from, BasicUser to, MailContext context, MailContentProducer producer, FileInfo... attachments)Previews an e-mail sending, returning the context without sending any e-mailsvoidsend(String toName, String toEmail, String subject, String body, FileInfo... attachments)Sends a new e-mail with the given information.voidsend(BasicUser from, BasicUser to, MailContext context, MailContentProducer producer, FileInfo... attachments)Creates a new e-mail pending to be sent by a recurring task.
If context is FORWARD_INTERNAL_MESSAGE: The "From name" of the message will be the name of the given from user The "From address" of the message will be the one declared in the configuration of the given from user. The "Reply-to address" of the message will be the address of the given from user. If context is NEW_EMAIL_VALIDATION: The "To address" will be the new email
-
-
-
Method Detail
-
applyTemplate
String applyTemplate(ApplyMailTemplateParams params)
Applies the configured e-mail template. Variables in the form{name}are replaced. All profile field variables are supported (seeProfileFieldHandler.getUserVariables()), plus others, such as:subject,message,salutation,unsubscribe,applicationName,date,dateTime,day,monthandyear. SeegetMailTemplateVariables()
-
createMailProcessingContext
MailProcessingContext createMailProcessingContext(String toName, String toEmail, String subject, String body, ConfigurationAccessor configurationAccessor, FileInfo... attachments)
Returns the context for sending an e-mail with the given information.- Parameters:
toName- Name of the receiver.toEmail- Email of the receiver.subject- Subject of the e-mailbody- Body of the e-mailconfigurationAccessor- The configuration accessor to get the from name/e-mailattachments- The e-mail attachments
-
getMailSender
JavaMailSender getMailSender()
Returns a JavaMailSender for the current configuration
-
getMailSender
JavaMailSender getMailSender(Configuration configuration)
Returns a JavaMailSender for the given configuration
-
getMailSender
JavaMailSender getMailSender(ConfigurationAccessor configuration)
Returns a JavaMailSender for the given configuration accessor
-
getMailTemplateVariables
List<ParameterVO> getMailTemplateVariables()
Returns the list of available variables applied to email templates.
-
preview
MailProcessingContext preview(BasicUser from, BasicUser to, MailContext context, MailContentProducer producer, FileInfo... attachments)
Previews an e-mail sending, returning the context without sending any e-mails
-
send
void send(BasicUser from, BasicUser to, MailContext context, MailContentProducer producer, FileInfo... attachments)
Creates a new e-mail pending to be sent by a recurring task.
If context is FORWARD_INTERNAL_MESSAGE:- The "From name" of the message will be the name of the given from user
- The "From address" of the message will be the one declared in the configuration of the given from user.
- The "Reply-to address" of the message will be the address of the given from user.
If context is NEW_EMAIL_VALIDATION:- The "To address" will be the new email
-
send
void send(String toName, String toEmail, String subject, String body, FileInfo... attachments)
Sends a new e-mail with the given information.- Parameters:
toName- Name of the receiver.toEmail- Email of the receiver.subject- Subject of the e-mailbody- Body of the e-mailattachments- The e-mail attachments
-
-