Class AbstractEmailService

All Implemented Interfaces:
IEmailService, IServiceDefinitionAware
Direct Known Subclasses:
ExchangeEmailService, FluentEmailService, GroovyEmailService, SmtpEmailService, TrashCanEmailService

public abstract class AbstractEmailService extends CayenneService implements IEmailService
Provides an abstract Email Service.
Since:
4.3.2
  • Field Details

  • 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 interface IEmailService
      Parameters:
      portal - the portal object
      submission - the submission (optional, will be used to resolve IEmailService if set)
      from - from address
      to - to address
      subject - the email subject
      body - the email body
      category - 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 interface IEmailService
      Parameters:
      portal - the portal object
      submission - the submission (optional, will be used to resolve IEmailService if set)
      from - from address
      to - to address
      subject - the email subject
      body - the email body
      category - the category of the email queue
      attachmentMap - 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 interface IEmailService
      Parameters:
      portal - the portal object
      submission - the submission (optional, will be used to resolve IEmailService at send time if set)
      from - from address
      to - to address
      replyTo - the reply to address
      subject - the email subject
      body - the email body
      category - the category of the email queue
      attachmentMap - 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 interface IEmailService
      Parameters:
      portal - the portal object
      submission - the submission (optional, will be used to resolve IEmailService at send time if set)
      from - from address
      to - to address
      cc - cc address
      replyTo - the reply to address
      subject - the email subject
      body - the email body
      category - the category of the email queue
      attachmentMap - 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 interface IEmailService
      Parameters:
      portal - the portal object
      submission - the submission (optional, will be used to resolve IEmailService at send time if set)
      from - from address
      to - to address
      cc - cc address
      bcc - bcc address
      replyTo - the reply to address
      subject - the email subject
      body - the email body
      category - the category of the email queue
      attachmentMap - 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 interface IEmailService
      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

      public void queueAccountStatusNotification(UserAccount userAccount, Portal portal)
      Create the account status notification on the email queue.

      Note that this method contains database transactions.

      Specified by:
      queueAccountStatusNotification in interface IEmailService
      Parameters:
      userAccount - the user account (required)
      portal - the user portal (required)
    • queueNewAccountNotification

      public void queueNewAccountNotification(UserAccount userAccount, Portal portal)
      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 interface IEmailService
      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 interface IEmailService
      Parameters:
      toAddress - email to address
      formName - email from address
      promotionLevelName - promotion level name
      clientName - a client name
      notes - 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 interface IEmailService
      Parameters:
      submission - a submission object
      emailSubject - email subject
      emailBody - email body
    • queueSavedFormEmail

      public void queueSavedFormEmail(Submission submission, String formUrl, String toAddress)
      Queue email with a link to a saved submission to an anonymous user
      Specified by:
      queueSavedFormEmail in interface IEmailService
      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 interface IEmailService
      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 interface IEmailService
      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
    • queueShareFormEmail

      public void queueShareFormEmail(Submission submission, String senderName, String emailAddresses, String emailBody)
      Queue an email notifying people with whom a saved form has been shared.

      Note that this method contains database transactions.

      Specified by:
      queueShareFormEmail in interface IEmailService
      Parameters:
      submission - the submission (required)
      senderName - the name of the person sharing the submission (optional)
      emailAddresses - the list of recipients (required)
      emailBody - the email body (optional)
      Since:
      4.0.0
    • renderDeploymentPropertyTemplate

      public String 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. 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 interface IEmailService
      Parameters:
      templateName - the template Deployment Property name
      model - 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 interface IEmailService
      Parameters:
      subject - email subject
      message - email message body
      from - email from address
      toAddress - email to address
      backgroundThread - 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 subject
      message - email message body
      from - email from address
      toAddress - email to address
      submission - the associated submission (optional)
      backgroundThread - send the email using a background thread
      Since:
      19.11.5
    • sendMessage

      public void sendMessage(String subject, String message, String from, String toAddress)
      Send an email message.
      Specified by:
      sendMessage in interface IEmailService
      Parameters:
      subject - email subject
      message - email message body
      from - email from address
      toAddress - 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 interface IEmailService
      Parameters:
      subject - email subject
      message - email message body
      from - email from address
      toAddress - email to address
      ccAddress - 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 interface IEmailService
      Parameters:
      subject - email subject
      message - email message body
      fromAddress - the from address
      toAddress - email to address
      ccAddress - email address to cc
      attachmentMap - 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 interface IEmailService
      Parameters:
      subject - email subject
      message - email message body
      fromAddress - the from address
      replyToAddress - the reply to address
      toAddress - email to address
      ccAddress - email address to cc
      bccAddress - email address to bcc
      attachmentMap - 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 interface IEmailService
      Parameters:
      subject - email subject (required)
      message - email message body (required)
      fromAddress - the from address
      toAddress - email to address (required)
      deliveryAttachmentsMap - submission delivery process attachments map (required)
      Since:
      3.5.1
    • queueOrSendFormConfirmationReceiptMessage

      @Deprecated public boolean queueOrSendFormConfirmationReceiptMessage(Submission submission, String toAddress)
      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 interface IEmailService
      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

      public boolean queueFormReceiptEmail(Submission submission, String toAddress)
      Queue email for submission receipt to an address.
      Specified by:
      queueFormReceiptEmail in interface IEmailService
      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

      public boolean queueFormReceiptEmail(Submission submission, String toAddress, String ccAddress)
      Queue email for submission receipt to an address.
      Specified by:
      queueFormReceiptEmail in interface IEmailService
      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 interface IEmailService
      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

      public void sendFormReceiptMessage(Submission submission, String toAddress)
      Send a submission receipt to an address.
      Specified by:
      sendFormReceiptMessage in interface IEmailService
      Parameters:
      submission - a submission (required)
      toAddress - an email address to send (required)
    • sendFormConfirmationMessage

      public void sendFormConfirmationMessage(Submission submission, String toAddress)
      Send a submission confirmation email to an address, which does not include a PDF receipt
      Specified by:
      sendFormConfirmationMessage in interface IEmailService
      Parameters:
      submission - a submission (required)
      toAddress - an email address to send (required)
      Since:
      4.3.2
    • sendSavedFormEmail

      public void sendSavedFormEmail(Submission submission, String formUrl, String toAddress)
      Send an email with a link to a saved submission to an anonymous user
      Specified by:
      sendSavedFormEmail in interface IEmailService
      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 interface IEmailService
      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

      public void sendLostPasswordMessage(UserAccount userAccount, String loginURL, Portal portal)
      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 interface IEmailService
      Parameters:
      userAccount - the user account object
      loginURL - the URL for the user to change the password
      portal - the portal which take the request
    • sendWelcomeUserMessage

      public void sendWelcomeUserMessage(UserAccount userAccount, Portal portal)
      Send a welcome message to the user. Note that a new temp password is generated.
      Specified by:
      sendWelcomeUserMessage in interface IEmailService
      Parameters:
      userAccount - the user account
      portal - the portal instance
      Since:
      19.11.0
    • sendWelcomeUserMessage

      public void sendWelcomeUserMessage(UserAccount userAccount, Portal portal, String tempPassword)
      Send a welcome message to the user
      Specified by:
      sendWelcomeUserMessage in interface IEmailService
      Parameters:
      userAccount - the user account
      portal - the portal instance
      tempPassword - the user password
    • sendTaskNotification

      public boolean sendTaskNotification(Submission submission)
      Send a task notification to a user or a group of users.
      Specified by:
      sendTaskNotification in interface IEmailService
      Parameters:
      submission - the task submission (required)
      Returns:
      true if at least one addressee was found.
    • sendEmailVerification

      public void sendEmailVerification(Submission submission)
      Immediately send an submission verification email.
      Specified by:
      sendEmailVerification in interface IEmailService
      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 interface IEmailService
      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

      public String sendDuplicatePaymentAlertEmailToClientAdmin(PaymentLog paymentLog)
      Send a duplicate payment alert email related to a payment log entry and return the sent email body message.
      Specified by:
      sendDuplicatePaymentAlertEmailToClientAdmin in interface IEmailService
      Parameters:
      paymentLog - the paymentLog to generate the context for (required)
      Returns:
      the sent email body message
      Since:
      4.0.0
    • sendFraudAlertEmailToClientAdmin

      public String sendFraudAlertEmailToClientAdmin(PaymentLog paymentLog)
      Send a fraud alert email related to a payment log entry and return the sent email body message.
      Specified by:
      sendFraudAlertEmailToClientAdmin in interface IEmailService
      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 interface IEmailService
      Parameters:
      submission - the form submission
      subject - the email subject line
      message - 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 interface IEmailService
      Parameters:
      submission - the form submission
      subject - the email subject line
      message - the email message content
      portal - the portal used to loookup the portal properties
      Returns:
      HTML border templated email message
      Since:
      4.3.0
    • getTemplatedEmailMessageForPortal

      public String getTemplatedEmailMessageForPortal(Portal portal, String subject, String message)
      Return the HTML border templated email message for the given submission.
      Specified by:
      getTemplatedEmailMessageForPortal in interface IEmailService
      Parameters:
      portal - the portal object
      subject - the email subject line
      message - 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 interface IEmailService
      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

      public ServiceDefinition getServiceDefinition()
      Return the underlying service definition.
      Specified by:
      getServiceDefinition in interface IServiceDefinitionAware
      Returns:
      the service definition
    • setServiceDefinition

      public void setServiceDefinition(ServiceDefinition serviceDefinition)
      Set the underlying service definition.
      Specified by:
      setServiceDefinition in interface IServiceDefinitionAware
      Parameters:
      serviceDefinition - the new service definition