Class Emailer
- java.lang.Object
-
- com.avoka.tm.svc.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 Summary
Constructors Constructor Description Emailer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidqueueEmail()Add the email to the email queue.voidsendEmail()Send the email immediately (synchronously).EmailersetAttachmentMap(Map<String,byte[]> attachmentMap)Set the email file attachments map, keyed on file name.EmailersetBccAddress(String bccAddress)Set the BCC send to email address.EmailersetCcAddress(String ccAddress)Set the CC send to email address.EmailersetFormReceiptTemplate(boolean userFormReceiptTemplate)Set to use the Email Form Receipt templates.EmailersetFromAddress(String fromAddress)Set the address to send the email from.EmailersetMessage(String message)Set the email message body.EmailersetModel(Map<String,Object> model)Set model data to merge with the space template.EmailersetReplyToAddress(String replyToAddress)Set the reply to email address.EmailersetSavedFormTemplate(boolean useSavedFormTemplate)Set to use Email Saved Form templates.EmailersetSpaceTemplate(boolean useSpaceTemplate)Set to use the Email Space templates.EmailersetSubject(String subject)Set the email subject line.EmailersetToAddress(String toAddress)Set the address to send the email to.EmailersetTxn(Txn txn)Set the transaction to resolve the email service with.EmailersetTxnId(Long txnId)Set the transaction id to resolve the email service with.EmailersetVerificationTemplate(boolean useVerificationTemplate)Set to use the Email Verification.
-
-
-
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). Note: If using _useFormReceiptTemplate or _useSavedFormTemplate or _useSpaceTemplate or _useVerificationTemplate, some attributes such as _replyToAddress, _ccAddress, _bccAddress, _subject and _message will not be used. These attributes are used when sending generic emails only. These are the attributes that are used to construct the email when one of these flags is set: _useFormReceiptTemplate: _txnId, _toAddress _useSavedFormTemplate: _txnId, _toAdress _useSpaceTemplate: _toAddress, _subject, _message, _model _useVerificationTemplate: _txnId
-
queueEmail
public void queueEmail()
Add the email to the email queue. Note: If using _useFormReceiptTemplate or _useSavedFormTemplate or _useSpaceTemplate, some attributes such as _replyToAddress, _bccAddress, _subject and _message will not be used. These attributes are used when sending generic emails only. These are the attributes that are used to construct the email when one of these flags is set: _useFormReceiptTemplate: _txnId, _toAddress, _ccAddress _useSavedFormTemplate: _txnId, _toAdress, _ccAddress _useSpaceTemplate: _toAddress, _subject, _message, _model Also note: This method does not support the _useVerificationTemplate flag.
-
-