public interface Emailer
processQueuedEmails()
method.Modifier and Type | Method and Description |
---|---|
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 subject,
java.lang.String body,
java.lang.String bodyContentType,
EmailAttachment... attachment)
Send email synchronously.
|
SendingMessage |
sendEmailAsync(EmailInfo info)
Send email asynchronously.
|
SendingMessage |
sendEmailAsync(EmailInfo info,
java.lang.Integer attemptsLimit,
java.util.Date deadline)
Send email asynchronously, with limited number of attempts.
|
void sendEmail(java.lang.String address, java.lang.String subject, java.lang.String body, java.lang.String bodyContentType, EmailAttachment... attachment) throws EmailException
address
- comma or semicolon separated list of addressessubject
- email subjectbody
- email bodybodyContentType
- email body like "text/plain; charset=UTF-8" or "text/html; charset=UTF-8", etcattachment
- email attachmentsEmailException
- in case of any errorsvoid sendEmail(EmailInfo info) throws EmailException
info
- email detailsEmailException
- in case of any errorsSendingMessage sendEmailAsync(EmailInfo info, @Nullable java.lang.Integer attemptsLimit, @Nullable java.util.Date deadline)
info
- email detailsattemptsLimit
- count of attempts to send (1 attempt per scheduler tick). If not specified,
EmailerProperties.getDefaultSendingAttemptsLimit()
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.NOT_SENT
SendingMessage
SendingMessage sendEmailAsync(EmailInfo info)
This method creates a SendingMessage
, 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
java.lang.String processQueuedEmails()
This method should be called periodically from a scheduled task.