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 void
queueEmail()
Add the email to the email queue.void
sendEmail()
Send the email immediately (synchronously).Emailer
setAttachmentMap(Map<String,byte[]> attachmentMap)
Set the email file attachments map, keyed on file name.Emailer
setBccAddress(String bccAddress)
Set the BCC send to email address.Emailer
setCcAddress(String ccAddress)
Set the CC send to email address.Emailer
setFormReceiptTemplate(boolean userFormReceiptTemplate)
Set to use the Email Form Receipt templates.Emailer
setFromAddress(String fromAddress)
Set the address to send the email from.Emailer
setMessage(String message)
Set the email message body.Emailer
setReplyToAddress(String replyToAddress)
Set the reply to email address.Emailer
setSavedFormTemplate(boolean useSavedFormTemplate)
Set to use Email Saved Form templates.Emailer
setSubject(String subject)
Set the email subject line.Emailer
setToAddress(String toAddress)
Set the address to send the email to.Emailer
setTxn(Txn txn)
Set the transaction to resolve the email service with.Emailer
setTxnId(Long txnId)
Set the transaction id to resolve the email service with.
-
-
-
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
-
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
-
sendEmail
public void sendEmail()
Send the email immediately (synchronously).
-
queueEmail
public void queueEmail()
Add the email to the email queue.
-
-