Class Emailer
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the email to the email queue.void
Send the email immediately (synchronously).setAttachmentMap
(Map<String, byte[]> attachmentMap) Set the email file attachments map, keyed on file name.setBccAddress
(String bccAddress) Set the BCC send to email address.setCcAddress
(String ccAddress) Set the CC send to email address.setFormReceiptTemplate
(boolean userFormReceiptTemplate) Set to use the Email Form Receipt templates.setFromAddress
(String fromAddress) Set the address to send the email from.setMessage
(String message) Set the email message body.Set model data to merge with the space template.setReplyToAddress
(String replyToAddress) Set the reply to email address.setSavedFormTemplate
(boolean useSavedFormTemplate) Set to use Email Saved Form templates.setSpaceTemplate
(boolean useSpaceTemplate) Set to use the Email Space templates.setSubject
(String subject) Set the email subject line.setToAddress
(String toAddress) Set the address to send the email to.Set the transaction to resolve the email service with.Set the transaction id to resolve the email service with.setVerificationTemplate
(boolean useVerificationTemplate) Set to use the Email Verification.
-
Constructor Details
-
Emailer
public Emailer()
-
-
Method Details
-
setSubject
Set the email subject line.- Parameters:
subject
- the email subject- Returns:
- the email service
-
setMessage
Set the email message body.- Parameters:
message
- the email message body- Returns:
- the email service
-
setToAddress
Set the address to send the email to.- Parameters:
toAddress
- the address to send the email to- Returns:
- the email service
-
setBccAddress
Set the BCC send to email address.- Parameters:
bccAddress
- the BCC send to email address- Returns:
- the email service
-
setCcAddress
Set the CC send to email address.- Parameters:
ccAddress
- the CC send to email address- Returns:
- the email service
-
setFromAddress
Set the address to send the email from.- Parameters:
fromAddress
- the address to send the email from- Returns:
- the email service
-
setReplyToAddress
Set the reply to email address.- Parameters:
replyToAddress
- the reply to email address- Returns:
- the email service
-
setAttachmentMap
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
Set the transaction to resolve the email service with.- Parameters:
txn
- the transaction to resolve the email service with- Returns:
- the email service
-
setTxnId
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
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
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
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
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
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.
-