Package com.avoka.fc.core.service.email
Class AbstractEmailService
java.lang.Object
com.avoka.fc.core.service.BaseService
com.avoka.fc.core.service.CayenneService
com.avoka.fc.core.service.email.AbstractEmailService
- All Implemented Interfaces:
IEmailService
,IServiceDefinitionAware
- Direct Known Subclasses:
ExchangeEmailService
,FluentEmailService
,GroovyEmailService
,SmtpEmailService
,TrashCanEmailService
Provides an abstract Email Service.
- Since:
- 4.3.2
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Provide an Email Format instance for use in Velocity templates.static class
Deprecated.static class
Deprecated.static class
Deprecated.static class
Deprecated. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Email Event Log message pattern.protected ServiceDefinition
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the underlying service definition.getTemplatedEmailMessageForPortal
(Portal portal, String subject, String message) Return the HTML border templated email message for the given submission.getTemplatedEmailMessageForSubmission
(Submission submission, String subject, String message) Return the HTML border templated email message for the given submission.getTemplatedEmailMessageForSubmission
(Submission submission, String subject, String message, Portal portal) Return the HTML border templated email message for the given submission.void
queueAccountStatusNotification
(UserAccount userAccount, Portal portal) Create the account status notification on the email queue.queueEmail
(Portal portal, Submission submission, String from, String to, String subject, String body, String category) Create an email on the email queuequeueEmail
(Portal portal, Submission submission, String from, String to, String cc, String bcc, String replyTo, String subject, String body, String category, Map<String, byte[]> attachmentMap) Create an email on the email queue.queueEmail
(Portal portal, Submission submission, String from, String to, String cc, String replyTo, String subject, String body, String category, Map<String, byte[]> attachmentMap) Create an email on the email queue.queueEmail
(Portal portal, Submission submission, String from, String to, String replyTo, String subject, String body, String category, Map<String, byte[]> attachmentMap) Create an email on the email queuequeueEmail
(Portal portal, Submission submission, String from, String to, String subject, String body, String category, Map<String, byte[]> attachmentMap) Create an email on the email queueboolean
queueFormReceiptEmail
(Submission submission, String toAddress) Queue email for submission receipt to an address.boolean
queueFormReceiptEmail
(Submission submission, String toAddress, String ccAddress) Queue email for submission receipt to an address.boolean
queueFormReceiptEmail
(Submission submission, String toAddress, String ccAddress, String bccAddress) Queue email for submission receipt to an address.void
queueNewAccountNotification
(UserAccount userAccount, Portal portal) Create new account notification on the email queue.boolean
queueOrSendFormConfirmationReceiptMessage
(Submission submission, String toAddress) Deprecated.void
queuePromotionNotificationMessage
(String toAddress, String formName, String promotionLevelName, String clientName, String notes) Queue a promotion notification message to the to addressvoid
queueSavedFormEmail
(Submission submission, String formUrl, String toAddress) Queue email with a link to a saved submission to an anonymous uservoid
queueSavedFormEmail
(Submission submission, String formUrl, String toAddress, String ccAddress) Queue email with a link to a saved submission to an anonymous uservoid
queueSavedFormEmail
(Submission submission, String formUrl, String toAddress, String ccAddress, String bccAddress) Queue email with a link to a saved submission to an anonymous uservoid
queueShareFormEmail
(Submission submission, String senderName, String emailAddresses, String emailBody) Queue an email notifying people with whom a saved form has been shared.void
queueSubmissionUpdateNotification
(Submission submission, String emailSubject, String emailBody) Create the submission update notification on an email queue.void
queueTemplatedMessageForPortal
(String emailAddress, String subject, String messageContent, Map<String, Object> model, Portal portal) Queue the templated email message for specified portal.renderDeploymentPropertyTemplate
(String templateName, Map model) Deprecated.This method does not use client/form/portal overrides for the DeploymentProperty.PROPERTY_Email_Default_Sender value when populating the "supportEmail" entry.Send a duplicate payment alert email related to a payment log entry and return the sent email body message.void
sendEmailVerification
(Submission submission) Immediately send an submission verification email.void
sendEmailVerification
(String loginName, String emailAddress, String givenName, String familyName, String userKey, Portal portal) Immediately send an email verification email for a new user.void
sendFormConfirmationMessage
(Submission submission, String toAddress) Send a submission confirmation email to an address, which does not include a PDF receiptvoid
sendFormReceiptMessage
(Submission submission, String toAddress) Send a submission receipt to an address.sendFraudAlertEmailToClientAdmin
(PaymentLog paymentLog) Send a fraud alert email related to a payment log entry and return the sent email body message.void
sendLostPasswordMessage
(UserAccount userAccount, String loginURL, Portal portal) Reset a user's password and send the email to his/her email address.void
sendMessage
(String subject, String message, String from, String toAddress) Send an email message.void
sendMessage
(String subject, String message, String from, String toAddress, boolean backgroundThread) Send an email message, optionally using a background thread.void
sendMessage
(String subject, String message, String from, String toAddress, Submission submission, boolean backgroundThread) Send an email message, optionally using a background thread.void
Send an email messagevoid
sendMessage
(String subject, String message, String fromAddress, String replyToAddress, String toAddress, String ccAddress, String bccAddress, Map<String, byte[]> attachmentMap) Send an email message.void
sendMessage
(String subject, String message, String fromAddress, String toAddress, String ccAddress, Map<String, byte[]> attachmentMap) Send an email message.void
sendMessageWithSubmissionAttachments
(String subject, String message, String fromAddress, String toAddress, Map<String, DataDocument> deliveryAttachmentsMap) Send an email message with the provided submission delivery process attachments map.void
sendSavedFormEmail
(Submission submission, String formUrl, String toAddress) Send an email with a link to a saved submission to an anonymous uservoid
sendSavedFormEmail
(Submission submission, String formUrl, String toAddress, boolean backgroundThread) Send an email with a link to a saved submission to an anonymous userboolean
sendTaskNotification
(Submission submission) Send a task notification to a user or a group of users.void
sendTemplatedMessageForPortal
(String emailAddress, String subject, String messageContent, Map<String, Object> model, Portal portal) Send the templated email message for specified portal.void
sendWelcomeUserMessage
(UserAccount userAccount, Portal portal) Send a welcome message to the user.void
sendWelcomeUserMessage
(UserAccount userAccount, Portal portal, String tempPassword) Send a welcome message to the uservoid
setServiceDefinition
(ServiceDefinition serviceDefinition) Set the underlying service definition.Methods inherited from class com.avoka.fc.core.service.CayenneService
commitChanges, deleteObject, deleteObjects, findObject, getDataContext, getDataDomain, getObjectForPK, getObjectStore, newObject, performNamedQuery, performNamedQuery, performNamedQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performQuery, performQuery, refetchEntity, refetchObject, registerNewObject, rollbackChanges, toMap, toMap
Methods inherited from class com.avoka.fc.core.service.BaseService
getLogger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.avoka.fc.core.service.IEmailService
sendEmailMessage
-
Field Details
-
EMAIL_INFO_EVENT_LOG_PATTEN
Email Event Log message pattern.- See Also:
-
serviceDefinition
-
-
Constructor Details
-
AbstractEmailService
public AbstractEmailService()
-
-
Method Details
-
queueEmail
public EmailQueue queueEmail(Portal portal, Submission submission, String from, String to, String subject, String body, String category) Create an email on the email queue Note that this method contains database transactions.- Specified by:
queueEmail
in interfaceIEmailService
- Parameters:
portal
- the portal objectsubmission
- the submission (optional, will be used to resolve IEmailService if set)from
- from addressto
- to addresssubject
- the email subjectbody
- the email bodycategory
- the category of the email queue- Returns:
- the resulting email queue entry
-
queueEmail
public EmailQueue queueEmail(Portal portal, Submission submission, String from, String to, String subject, String body, String category, Map<String, byte[]> attachmentMap) Create an email on the email queue Note that this method contains database transactions.- Specified by:
queueEmail
in interfaceIEmailService
- Parameters:
portal
- the portal objectsubmission
- the submission (optional, will be used to resolve IEmailService if set)from
- from addressto
- to addresssubject
- the email subjectbody
- the email bodycategory
- the category of the email queueattachmentMap
- the map of attachments (optional)- Returns:
- the resulting email queue entry
-
queueEmail
public EmailQueue queueEmail(Portal portal, Submission submission, String from, String to, String replyTo, String subject, String body, String category, Map<String, byte[]> attachmentMap) Create an email on the email queue Note that this method contains database transactions.- Specified by:
queueEmail
in interfaceIEmailService
- Parameters:
portal
- the portal objectsubmission
- the submission (optional, will be used to resolve IEmailService at send time if set)from
- from addressto
- to addressreplyTo
- the reply to addresssubject
- the email subjectbody
- the email bodycategory
- the category of the email queueattachmentMap
- the map of attachments (optional)- Returns:
- the resulting email queue entry
- Since:
- 4.3.4
-
queueEmail
public EmailQueue queueEmail(Portal portal, Submission submission, String from, String to, String cc, String replyTo, String subject, String body, String category, Map<String, byte[]> attachmentMap) Create an email on the email queue. Note that this method contains database transactions.- Specified by:
queueEmail
in interfaceIEmailService
- Parameters:
portal
- the portal objectsubmission
- the submission (optional, will be used to resolve IEmailService at send time if set)from
- from addressto
- to addresscc
- cc addressreplyTo
- the reply to addresssubject
- the email subjectbody
- the email bodycategory
- the category of the email queueattachmentMap
- the map of attachments (optional)- Returns:
- the resulting email queue entry
- Since:
- 18.5.0
-
queueEmail
public EmailQueue queueEmail(Portal portal, Submission submission, String from, String to, String cc, String bcc, String replyTo, String subject, String body, String category, Map<String, byte[]> attachmentMap) Create an email on the email queue. Note that this method contains database transactions.- Specified by:
queueEmail
in interfaceIEmailService
- Parameters:
portal
- the portal objectsubmission
- the submission (optional, will be used to resolve IEmailService at send time if set)from
- from addressto
- to addresscc
- cc addressbcc
- bcc addressreplyTo
- the reply to addresssubject
- the email subjectbody
- the email bodycategory
- the category of the email queueattachmentMap
- the map of attachments (optional)- Returns:
- the resulting email queue entry
- Since:
- 21.11.4
-
queueTemplatedMessageForPortal
public void queueTemplatedMessageForPortal(String emailAddress, String subject, String messageContent, Map<String, Object> model, Portal portal) Queue the templated email message for specified portal. The Portal Property "Email Template HTML" provides the email message body. Note that this method contains database transactions.- Specified by:
queueTemplatedMessageForPortal
in interfaceIEmailService
- Parameters:
emailAddress
- the email address to send the email to (required)subject
- the email (required)messageContent
- the inner email message content (required)model
- the model to merge with the messageContent (required)portal
- the portal which provides the "Email Template HTML" property (required)- Since:
- 4.1.0
-
queueAccountStatusNotification
Create the account status notification on the email queue. Note that this method contains database transactions.- Specified by:
queueAccountStatusNotification
in interfaceIEmailService
- Parameters:
userAccount
- the user account (required)portal
- the user portal (required)
-
queueNewAccountNotification
Create new account notification on the email queue. Note that this method contains database transactions. Note that this method contains database transactions.- Specified by:
queueNewAccountNotification
in interfaceIEmailService
- Parameters:
userAccount
- the user account (required)portal
- the user portal (required)
-
queuePromotionNotificationMessage
public void queuePromotionNotificationMessage(String toAddress, String formName, String promotionLevelName, String clientName, String notes) Queue a promotion notification message to the to address Note that this method contains database transactions.- Specified by:
queuePromotionNotificationMessage
in interfaceIEmailService
- Parameters:
toAddress
- email to addressformName
- email from addresspromotionLevelName
- promotion level nameclientName
- a client namenotes
- some notes to be displayed in the message
-
queueSubmissionUpdateNotification
public void queueSubmissionUpdateNotification(Submission submission, String emailSubject, String emailBody) Create the submission update notification on an email queue. Note that this method contains database transactions.- Specified by:
queueSubmissionUpdateNotification
in interfaceIEmailService
- Parameters:
submission
- a submission objectemailSubject
- email subjectemailBody
- email body
-
queueSavedFormEmail
Queue email with a link to a saved submission to an anonymous user- Specified by:
queueSavedFormEmail
in interfaceIEmailService
- Parameters:
submission
- the saved form submission (required)formUrl
- the return form link URL (required)toAddress
- the email address to send to (required)- Since:
- 5.1.0
-
queueSavedFormEmail
public void queueSavedFormEmail(Submission submission, String formUrl, String toAddress, String ccAddress) Queue email with a link to a saved submission to an anonymous user- Specified by:
queueSavedFormEmail
in interfaceIEmailService
- Parameters:
submission
- the saved form submission (required)formUrl
- the return form link URL (required)toAddress
- the email address to send to (required)ccAddress
- email address to cc (optional)- Since:
- 18.5.0
-
queueSavedFormEmail
public void queueSavedFormEmail(Submission submission, String formUrl, String toAddress, String ccAddress, String bccAddress) Queue email with a link to a saved submission to an anonymous user- Specified by:
queueSavedFormEmail
in interfaceIEmailService
- Parameters:
submission
- the saved form submission (required)formUrl
- the return form link URL (required)toAddress
- the email address to send to (required)ccAddress
- email address to cc (optional)bccAddress
- email address to bcc (optional)- Since:
- 21.11.4
-
renderDeploymentPropertyTemplate
Deprecated.This method does not use client/form/portal overrides for the DeploymentProperty.PROPERTY_Email_Default_Sender value when populating the "supportEmail" entry. If you need this, you can call PropertyValueDao.renderEmailStringTemplate(deploymentPropertyDao.getPropertyValue(templateName), model, client, version, portal)Render the named Deployment Property template value with the model using the Velocity engine.- Specified by:
renderDeploymentPropertyTemplate
in interfaceIEmailService
- Parameters:
templateName
- the template Deployment Property namemodel
- the model to render- Returns:
- the rendered template
- Since:
- 3.6.0
-
sendMessage
public void sendMessage(String subject, String message, String from, String toAddress, boolean backgroundThread) Send an email message, optionally using a background thread.- Specified by:
sendMessage
in interfaceIEmailService
- Parameters:
subject
- email subjectmessage
- email message bodyfrom
- email from addresstoAddress
- email to addressbackgroundThread
- send the email using a background thread- Since:
- 4.3.0
-
sendMessage
public void sendMessage(String subject, String message, String from, String toAddress, Submission submission, boolean backgroundThread) Send an email message, optionally using a background thread.- Parameters:
subject
- email subjectmessage
- email message bodyfrom
- email from addresstoAddress
- email to addresssubmission
- the associated submission (optional)backgroundThread
- send the email using a background thread- Since:
- 19.11.5
-
sendMessage
Send an email message.- Specified by:
sendMessage
in interfaceIEmailService
- Parameters:
subject
- email subjectmessage
- email message bodyfrom
- email from addresstoAddress
- email to address
-
sendMessage
public void sendMessage(String subject, String message, String from, String toAddress, String ccAddress) Send an email message- Specified by:
sendMessage
in interfaceIEmailService
- Parameters:
subject
- email subjectmessage
- email message bodyfrom
- email from addresstoAddress
- email to addressccAddress
- email address to cc
-
sendMessage
public void sendMessage(String subject, String message, String fromAddress, String toAddress, String ccAddress, Map<String, byte[]> attachmentMap) Send an email message.- Specified by:
sendMessage
in interfaceIEmailService
- Parameters:
subject
- email subjectmessage
- email message bodyfromAddress
- the from addresstoAddress
- email to addressccAddress
- email address to ccattachmentMap
- attachments map
-
sendMessage
public void sendMessage(String subject, String message, String fromAddress, String replyToAddress, String toAddress, String ccAddress, String bccAddress, Map<String, byte[]> attachmentMap) Send an email message.- Specified by:
sendMessage
in interfaceIEmailService
- Parameters:
subject
- email subjectmessage
- email message bodyfromAddress
- the from addressreplyToAddress
- the reply to addresstoAddress
- email to addressccAddress
- email address to ccbccAddress
- email address to bccattachmentMap
- attachments map
-
sendMessageWithSubmissionAttachments
public void sendMessageWithSubmissionAttachments(String subject, String message, String fromAddress, String toAddress, Map<String, DataDocument> deliveryAttachmentsMap) Send an email message with the provided submission delivery process attachments map.- Specified by:
sendMessageWithSubmissionAttachments
in interfaceIEmailService
- Parameters:
subject
- email subject (required)message
- email message body (required)fromAddress
- the from addresstoAddress
- email to address (required)deliveryAttachmentsMap
- submission delivery process attachments map (required)- Since:
- 3.5.1
-
queueOrSendFormConfirmationReceiptMessage
@Deprecated public boolean queueOrSendFormConfirmationReceiptMessage(Submission submission, String toAddress) Deprecated.This can be used to queue an email to the user containing the receipt. Note: This method will use the contact email address, then try the user's email address. If neither is available, no email will be queued. This method will either use the Email Queue so user thread is not blocked sending the email.- Specified by:
queueOrSendFormConfirmationReceiptMessage
in interfaceIEmailService
- Parameters:
submission
- the submission (required)toAddress
- the send to email address- Returns:
- true if an email was queue, or false if not user email address was found
- Since:
- 4.1.0
-
queueFormReceiptEmail
Queue email for submission receipt to an address.- Specified by:
queueFormReceiptEmail
in interfaceIEmailService
- Parameters:
submission
- a submission (required)toAddress
- an email address to send (required)- Returns:
- true if an email was queue, or false if not user email address was found
- Since:
- 5.1.0
-
queueFormReceiptEmail
Queue email for submission receipt to an address.- Specified by:
queueFormReceiptEmail
in interfaceIEmailService
- Parameters:
submission
- a submission (required)toAddress
- an email address to send (required)ccAddress
- email address to cc (optional)- Returns:
- true if an email was queue, or false if not user email address was found
- Since:
- 18.5.0
-
queueFormReceiptEmail
public boolean queueFormReceiptEmail(Submission submission, String toAddress, String ccAddress, String bccAddress) Queue email for submission receipt to an address.- Specified by:
queueFormReceiptEmail
in interfaceIEmailService
- Parameters:
submission
- a submission (required)toAddress
- an email address to send (required)ccAddress
- email address to cc (optional)bccAddress
- email address to bcc (optional)- Returns:
- true if an email was queue, or false if not user email address was found
- Since:
- 21.11.4
-
sendFormReceiptMessage
Send a submission receipt to an address.- Specified by:
sendFormReceiptMessage
in interfaceIEmailService
- Parameters:
submission
- a submission (required)toAddress
- an email address to send (required)
-
sendFormConfirmationMessage
Send a submission confirmation email to an address, which does not include a PDF receipt- Specified by:
sendFormConfirmationMessage
in interfaceIEmailService
- Parameters:
submission
- a submission (required)toAddress
- an email address to send (required)- Since:
- 4.3.2
-
sendSavedFormEmail
Send an email with a link to a saved submission to an anonymous user- Specified by:
sendSavedFormEmail
in interfaceIEmailService
- Parameters:
submission
- the saved form submission (required)formUrl
- the return form link URL (required)toAddress
- the email address to send to (required)
-
sendSavedFormEmail
public void sendSavedFormEmail(Submission submission, String formUrl, String toAddress, boolean backgroundThread) Send an email with a link to a saved submission to an anonymous user- Specified by:
sendSavedFormEmail
in interfaceIEmailService
- Parameters:
submission
- the saved form submission (required)formUrl
- the return form link URL (required)toAddress
- the email address to send to (required)backgroundThread
- send email in background thread- Since:
- 4.3.0
-
sendLostPasswordMessage
Reset a user's password and send the email to his/her email address. Note that this method contains database transactions.- Specified by:
sendLostPasswordMessage
in interfaceIEmailService
- Parameters:
userAccount
- the user account objectloginURL
- the URL for the user to change the passwordportal
- the portal which take the request
-
sendWelcomeUserMessage
Send a welcome message to the user. Note that a new temp password is generated.- Specified by:
sendWelcomeUserMessage
in interfaceIEmailService
- Parameters:
userAccount
- the user accountportal
- the portal instance- Since:
- 19.11.0
-
sendWelcomeUserMessage
Send a welcome message to the user- Specified by:
sendWelcomeUserMessage
in interfaceIEmailService
- Parameters:
userAccount
- the user accountportal
- the portal instancetempPassword
- the user password
-
sendTaskNotification
Send a task notification to a user or a group of users.- Specified by:
sendTaskNotification
in interfaceIEmailService
- Parameters:
submission
- the task submission (required)- Returns:
- true if at least one addressee was found.
-
sendEmailVerification
Immediately send an submission verification email.- Specified by:
sendEmailVerification
in interfaceIEmailService
- Parameters:
submission
- the submission (required)
-
sendEmailVerification
public void sendEmailVerification(String loginName, String emailAddress, String givenName, String familyName, String userKey, Portal portal) Immediately send an email verification email for a new user.- Specified by:
sendEmailVerification
in interfaceIEmailService
- Parameters:
loginName
- the user's login name (required)emailAddress
- the user's email address (required)givenName
- the user's given name (required)familyName
- the user's family name (required)userKey
- the user's user key (required)portal
- the user portal (required)
-
sendDuplicatePaymentAlertEmailToClientAdmin
Send a duplicate payment alert email related to a payment log entry and return the sent email body message.- Specified by:
sendDuplicatePaymentAlertEmailToClientAdmin
in interfaceIEmailService
- Parameters:
paymentLog
- the paymentLog to generate the context for (required)- Returns:
- the sent email body message
- Since:
- 4.0.0
-
sendFraudAlertEmailToClientAdmin
Send a fraud alert email related to a payment log entry and return the sent email body message.- Specified by:
sendFraudAlertEmailToClientAdmin
in interfaceIEmailService
- Parameters:
paymentLog
- the paymentLog to generate the context for (required)- Returns:
- the sent email body message
- Since:
- 4.0.0
-
getTemplatedEmailMessageForSubmission
public String getTemplatedEmailMessageForSubmission(Submission submission, String subject, String message) Return the HTML border templated email message for the given submission.- Specified by:
getTemplatedEmailMessageForSubmission
in interfaceIEmailService
- Parameters:
submission
- the form submissionsubject
- the email subject linemessage
- the email message content- Returns:
- HTML border templated email message
- Since:
- 4.0.0
-
getTemplatedEmailMessageForSubmission
public String getTemplatedEmailMessageForSubmission(Submission submission, String subject, String message, Portal portal) Return the HTML border templated email message for the given submission.- Specified by:
getTemplatedEmailMessageForSubmission
in interfaceIEmailService
- Parameters:
submission
- the form submissionsubject
- the email subject linemessage
- the email message contentportal
- the portal used to loookup the portal properties- Returns:
- HTML border templated email message
- Since:
- 4.3.0
-
getTemplatedEmailMessageForPortal
Return the HTML border templated email message for the given submission.- Specified by:
getTemplatedEmailMessageForPortal
in interfaceIEmailService
- Parameters:
portal
- the portal objectsubject
- the email subject linemessage
- the email message content- Returns:
- HTML border templated email message
- Since:
- 4.0.0
-
sendTemplatedMessageForPortal
public void sendTemplatedMessageForPortal(String emailAddress, String subject, String messageContent, Map<String, Object> model, Portal portal) Send the templated email message for specified portal. The Portal Property "Email Template HTML" provides the email message body.- Specified by:
sendTemplatedMessageForPortal
in interfaceIEmailService
- Parameters:
emailAddress
- the email address to send the email to (required)subject
- the email (required)messageContent
- the inner email message content (required)model
- the model to merge with the messageContent (required)portal
- the portal which provides the "Email Template HTML" property (required)- Since:
- 4.1.0
-
getServiceDefinition
Return the underlying service definition.- Specified by:
getServiceDefinition
in interfaceIServiceDefinitionAware
- Returns:
- the service definition
-
setServiceDefinition
Set the underlying service definition.- Specified by:
setServiceDefinition
in interfaceIServiceDefinitionAware
- Parameters:
serviceDefinition
- the new service definition
-
queueFormReceiptEmail(Submission, String)
)