public interface EmailerAPI
processQueuedEmails()
method.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
loadContentText(SendingMessage sendingMessage)
Loads content text for given message.
|
void |
migrateAttachmentsToFileStorage(java.util.List<SendingAttachment> attachments)
Migrate list of existing email attachments to be stored in file storage, in a single transaction.
|
void |
migrateEmailsToFileStorage(java.util.List<SendingMessage> messages)
Migrate list of existing messages to be stored in file storage, in a single transaction.
|
java.lang.String |
processQueuedEmails()
Send emails added to the queue.
|
void |
sendEmail(EmailInfo info)
Send email synchronously.
|
void |
sendEmail(java.lang.String address,
java.lang.String caption,
java.lang.String body,
EmailAttachment... attachments)
Send email synchronously.
|
java.util.List<SendingMessage> |
sendEmailAsync(EmailInfo info)
Send email asynchronously.
|
java.util.List<SendingMessage> |
sendEmailAsync(EmailInfo info,
java.lang.Integer attemptsCount,
java.util.Date deadline)
Send email asynchronously, with limited number of attempts.
|
static final java.lang.String NAME
void sendEmail(java.lang.String address, java.lang.String caption, java.lang.String body, EmailAttachment... attachments) throws EmailException
address
- comma or semicolon separated list of addressescaption
- email subjectbody
- email bodyattachments
- email attachmentsEmailException
- in case of any errorsvoid sendEmail(EmailInfo info) throws EmailException
info
- email detailsEmailException
- in case of any errorsjava.util.List<SendingMessage> sendEmailAsync(EmailInfo info, @Nullable java.lang.Integer attemptsCount, @Nullable java.util.Date deadline)
info
- email detailsattemptsCount
- count of attempts to send (1 attempt per scheduler tick). If not specified,
EmailerConfig.getDefaultSendingAttemptsCount()
is useddeadline
- Emailer tries to send message till deadline.
If deadline has come and message has not been sent, status of this message is changed to
SendingStatus.NOTSENT
SendingMessage
sjava.util.List<SendingMessage> sendEmailAsync(EmailInfo info)
This method creates a list of SendingMessage
instances, saves it to the database and returns immediately.
The actual sending is performed by the processQueuedEmails()
method which should be invoked by a
scheduled task.
info
- email detailsSendingMessage
sjava.lang.String processQueuedEmails()
This method should be called periodically from a scheduled task.
void migrateEmailsToFileStorage(java.util.List<SendingMessage> messages)
void migrateAttachmentsToFileStorage(java.util.List<SendingAttachment> attachments)
java.lang.String loadContentText(SendingMessage sendingMessage)