Package io.jmix.email.impl
Class EmailerImpl
java.lang.Object
io.jmix.email.impl.EmailerImpl
- All Implemented Interfaces:
- Emailer
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected SystemAuthenticatorprotected AtomicIntegerprotected EmailCleanerprotected EmailDataProviderprotected EmailerPropertiesprotected EmailSenderprotected org.springframework.core.task.TaskExecutorprotected Metadataprotected MetadataTools
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected SendingMessageconvertToSendingMessage(EmailInfo info, Integer attemptsLimit, Date deadline) protected SendingMessagecreateClone(SendingMessage srcMessage) protected StringgetContentBodyType(SendingMessage sendingMessage) protected booleanprotected voidpersistAndSendEmail(EmailInfo emailInfo) protected SendingMessagepersistMessageIfPossible(SendingMessage sendingMessage) protected voidprepareEmailInfo(EmailInfo emailInfo) Send emails added to the queue.protected voidvoidSend email synchronously.voidsendEmail(String address, String subject, String body, String bodyContentType, Boolean important, EmailAttachment... attachment) Send email synchronously.sendEmailAsync(EmailInfo info) Send email asynchronously.sendEmailAsync(EmailInfo info, Integer attemptsLimit, Date deadline) Send email asynchronously, with limited number of attempts.protected Stringprotected voidsendSendingMessage(SendingMessage sendingMessage) protected voidprotected SendingAttachment
- 
Field Details- 
emailerProperties
- 
callCount
- 
mailSendTaskExecutorprotected org.springframework.core.task.TaskExecutor mailSendTaskExecutor
- 
emailDataProvider
- 
metadata
- 
authenticator
- 
emailSender
- 
metadataTools
- 
applicationContext@Autowired protected org.springframework.context.ApplicationContext applicationContext
- 
emailCleaner
 
- 
- 
Constructor Details- 
EmailerImplpublic EmailerImpl()
 
- 
- 
Method Details- 
sendEmailpublic void sendEmail(String address, String subject, String body, String bodyContentType, Boolean important, EmailAttachment... attachment) throws EmailException Description copied from interface:EmailerSend email synchronously.- Specified by:
- sendEmailin interface- Emailer
- Parameters:
- address- comma or semicolon separated list of addresses
- subject- email subject
- body- email body
- bodyContentType- email body like "text/plain; charset=UTF-8" or "text/html; charset=UTF-8", etc
- attachment- email attachments
- Throws:
- EmailException- in case of any errors
 
- 
sendEmailDescription copied from interface:EmailerSend email synchronously.- Specified by:
- sendEmailin interface- Emailer
- Parameters:
- info- email details
- Throws:
- EmailException- in case of any errors
 
- 
sendEmailAsyncDescription copied from interface:EmailerSend email asynchronously.This method creates a SendingMessage, saves it to the database and returns immediately. The actual sending is performed by theEmailer.processQueuedEmails()method which should be invoked by a scheduled task.- Specified by:
- sendEmailAsyncin interface- Emailer
- Parameters:
- info- email details
- Returns:
- created SendingMessage
 
- 
sendEmailAsyncpublic SendingMessage sendEmailAsync(EmailInfo info, @Nullable Integer attemptsLimit, @Nullable Date deadline) Description copied from interface:EmailerSend email asynchronously, with limited number of attempts.- Specified by:
- sendEmailAsyncin interface- Emailer
- Parameters:
- info- email details
- attemptsLimit- count of attempts to send (1 attempt per scheduler tick). If not specified,- EmailerProperties.getDefaultSendingAttemptsLimit()is used
- deadline- 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
- Returns:
- created SendingMessage
 
- 
prepareEmailInfo
- 
convertToSendingMessageprotected SendingMessage convertToSendingMessage(EmailInfo info, @Nullable Integer attemptsLimit, @Nullable Date deadline) 
- 
sendSendingMessage
- 
persistAndSendEmail- Throws:
- EmailException
 
- 
persistMessageIfPossible
- 
createClone
- 
processQueuedEmailsDescription copied from interface:EmailerSend emails added to the queue.This method should be called periodically from a scheduled task. - Specified by:
- processQueuedEmailsin interface- Emailer
- Returns:
- short message describing how many emails were sent, or error message
 
- 
sendQueuedEmails
- 
submitExecutorTask
- 
getContentBodyType
- 
replaceRecipientIfNecessary
- 
toSendingAttachment
- 
isNeedToRetry
 
-