public class Emailer
extends java.lang.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("john@doe.com")
.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("john@doe.com")
.setReplyToAddress("reply@to.com")
.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("john@doe.com")
.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("john@doe.com")
.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(java.util.Map<java.lang.String,byte[]> attachmentMap)
|
Set the email file attachments map, keyed on file name.
|
Emailer |
setBccAddress(java.lang.String bccAddress) |
Set the BCC send to email address.
|
Emailer |
setCcAddress(java.lang.String ccAddress) |
Set the CC send to email address.
|
Emailer |
setFormReceiptTemplate(boolean userFormReceiptTemplate)
|
Set to use the Email Form Receipt templates.
|
Emailer |
setFromAddress(java.lang.String fromAddress) |
Set the address to send the email from.
|
Emailer |
setMessage(java.lang.String message) |
Set the email message body.
|
Emailer |
setReplyToAddress(java.lang.String replyToAddress) |
Set the reply to email address.
|
Emailer |
setSavedFormTemplate(boolean useSavedFormTemplate) |
Set to use Email Saved Form templates.
|
Emailer |
setSubject(java.lang.String subject) |
Set the email subject line.
|
Emailer |
setToAddress(java.lang.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(java.lang.Long txnId) |
Set the transaction id to resolve the email service with.
|
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString,
wait, wait, wait
Constructor Detail
Emailer
public Emailer()
Method Detail
setSubject
public Emailer setSubject(java.lang.String subject)
Set the email subject line.
- Parameters:
subject
- the email subject
- Returns:
- the email service
setMessage
public Emailer setMessage(java.lang.String message)
Set the email message body.
- Parameters:
message
- the email message body
- Returns:
- the email service
setToAddress
public Emailer setToAddress(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String replyToAddress)
Set the reply to email address.
- Parameters:
replyToAddress
- the reply to email address
- Returns:
- the email service
setAttachmentMap
public Emailer setAttachmentMap(java.util.Map<java.lang.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(java.lang.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.