Class Emailer


  • public class Emailer
    extends Object

    Provides an Email service.

    Examples

    Please find the email service examples about sending and queuing below.

    Send Email

    This example shows how to send an email by setting the transaction id to resolve the email service with.

     import com.avoka.tm.svc.Emailer
    
     new Emailer()
        .setToAddress("[email protected]")
        .setTxnId(3L)
        .setSubject("Subject")
        .setMessage("Hello, John Doe! How are you?")
        .sendEmail()  

    Queue Email

    This example shows how to queue email.

     import com.avoka.tm.svc.Emailer
    
     new Emailer()
        .setToAddress("[email protected]")
        .setReplyToAddress("[email protected]")
        .setSubject("Subject")
        .setMessage("Hello, John Doe! How are you?")
        .setAttachmentMap(attachments)
        .queueEmail()  

    Send Saved Form Email

    This example shows how to send email using the "Email Saved Form Message" and "Email Saved Form Subject" templates.

    When using the Form Receipt Template you must specify the transaction so that the service can resolve the email template configurations.

     import com.avoka.tm.svc.Emailer
    
     new Emailer()
        .setTxn(txn)
        .setToAddress("[email protected]")
        .setSavedFormTemplate(true)
        .sendEmail()  

    Send Form Receipt Email

    This example shows how to queue email using the "Email Form Receipt Message" and "Email Form Receipt Subject" templates. Please note the PDF may be included in the email depending upon the associated transactions form configuration.

    When using the Form Receipt Template you must specify the transaction so that the service can resolve the email template configurations.

     import com.avoka.tm.svc.Emailer
    
     new Emailer()
        .setTxn(txn)
        .setToAddress("[email protected]")
        .setFormReceiptTemplate(true)
        .queueEmail()  
    Since:
    5.0.0
    • Constructor Detail

      • Emailer

        public Emailer()
    • Method Detail

      • setSubject

        public Emailer setSubject​(String subject)
        Set the email subject line.
        Parameters:
        subject - the email subject
        Returns:
        the email service
      • setMessage

        public Emailer setMessage​(String message)
        Set the email message body.
        Parameters:
        message - the email message body
        Returns:
        the email service
      • setToAddress

        public Emailer setToAddress​(String toAddress)
        Set the address to send the email to.
        Parameters:
        toAddress - the address to send the email to
        Returns:
        the email service
      • setBccAddress

        public Emailer setBccAddress​(String bccAddress)
        Set the BCC send to email address.
        Parameters:
        bccAddress - the BCC send to email address
        Returns:
        the email service
      • setCcAddress

        public Emailer setCcAddress​(String ccAddress)
        Set the CC send to email address.
        Parameters:
        ccAddress - the CC send to email address
        Returns:
        the email service
      • setFromAddress

        public Emailer setFromAddress​(String fromAddress)
        Set the address to send the email from.
        Parameters:
        fromAddress - the address to send the email from
        Returns:
        the email service
      • setReplyToAddress

        public Emailer setReplyToAddress​(String replyToAddress)
        Set the reply to email address.
        Parameters:
        replyToAddress - the reply to email address
        Returns:
        the email service
      • setAttachmentMap

        public Emailer setAttachmentMap​(Map<String,​byte[]> attachmentMap)
        Set the email file attachments map, keyed on file name.
        Parameters:
        attachmentMap - the email file attachments map, keyed on file name
        Returns:
        the email service
      • setTxn

        public Emailer setTxn​(Txn txn)
        Set the transaction to resolve the email service with.
        Parameters:
        txn - the transaction to resolve the email service with
        Returns:
        the email service
      • setTxnId

        public Emailer setTxnId​(Long txnId)
        Set the transaction id to resolve the email service with.
        Parameters:
        txnId - the transaction id to resolve the email service with
        Returns:
        the email service
      • setModel

        public Emailer setModel​(Map<String,​Object> model)
        Set model data to merge with the space template.
        Parameters:
        model - the model data to merge
        Returns:
        the email service
        Since:
        19.11.0
      • setSavedFormTemplate

        public Emailer setSavedFormTemplate​(boolean useSavedFormTemplate)
        Set to use Email Saved Form templates. Please note you must also specify the Txn when using this property.
        Parameters:
        useSavedFormTemplate - Email Saved Form templates.
        Returns:
        the email service
        Since:
        5.1.0
      • setFormReceiptTemplate

        public Emailer setFormReceiptTemplate​(boolean userFormReceiptTemplate)
        Set to use the Email Form Receipt templates. Please note you must also specify the Txn when using this property.
        Parameters:
        userFormReceiptTemplate - use Email Form Receipt templates
        Returns:
        the email service
        Since:
        5.1.0
      • setSpaceTemplate

        public Emailer setSpaceTemplate​(boolean useSpaceTemplate)
        Set to use the Email Space templates. Please note you must also specify the Txn when using this property.
        Parameters:
        useSpaceTemplate - use space template
        Returns:
        the email service
        Since:
        19.11.0
      • setVerificationTemplate

        public Emailer setVerificationTemplate​(boolean useVerificationTemplate)
        Set to use the Email Verification. Please note you must also specify the Txn when using this property.
        Parameters:
        useVerificationTemplate - use txn verification email
        Returns:
        the email service
        Since:
        19.11.0
      • sendEmail

        public void sendEmail()
        Send the email immediately (synchronously).
      • queueEmail

        public void queueEmail()
        Add the email to the email queue.