@Component(value="cuba_EmailSender") public class EmailSender extends java.lang.Object implements EmailSenderAPI
Modifier and Type | Class and Description |
---|---|
protected static class |
EmailSender.MyByteArrayDataSource |
Modifier and Type | Field and Description |
---|---|
protected GlobalConfig |
globalConfig |
protected org.springframework.mail.javamail.JavaMailSender |
mailSender |
protected TimeSource |
timeSource |
NAME
Constructor and Description |
---|
EmailSender() |
Modifier and Type | Method and Description |
---|---|
protected void |
assignFromAddress(SendingMessage sendingMessage,
javax.mail.internet.MimeMessage msg) |
protected void |
assignRecipient(javax.mail.Message.RecipientType type,
java.lang.String addresses,
javax.mail.internet.MimeMessage message) |
protected javax.mail.internet.MimeBodyPart |
createAttachmentPart(SendingAttachment attachment) |
protected javax.mail.internet.MimeMessage |
createMimeMessage(SendingMessage sendingMessage) |
protected java.lang.String |
generateAttachmentContentId(java.lang.String attachmentName) |
void |
sendEmail(SendingMessage sendingMessage)
Sends email with help of
JavaMailSender . |
void |
setMailSender(org.springframework.mail.javamail.JavaMailSender mailSender) |
protected void |
setMimeMessageContent(SendingMessage sendingMessage,
javax.mail.internet.MimeMultipart content,
javax.mail.internet.MimeMultipart textPart) |
protected java.lang.Iterable<java.lang.String> |
splitAddresses(java.lang.String addresses) |
void |
updateSession() |
protected org.springframework.mail.javamail.JavaMailSender mailSender
@Inject protected TimeSource timeSource
@Inject protected GlobalConfig globalConfig
public void setMailSender(org.springframework.mail.javamail.JavaMailSender mailSender)
public void sendEmail(SendingMessage sendingMessage) throws javax.mail.MessagingException
EmailSenderAPI
JavaMailSender
.
Message body and attachments' content must be loaded from file storage.
EmailerAPI
instead if you need email to be delivered reliably and stored to email history.sendEmail
in interface EmailSenderAPI
javax.mail.MessagingException
- if delivery failspublic void updateSession()
updateSession
in interface EmailSenderAPI
protected javax.mail.internet.MimeMessage createMimeMessage(SendingMessage sendingMessage) throws javax.mail.MessagingException
javax.mail.MessagingException
protected void setMimeMessageContent(SendingMessage sendingMessage, javax.mail.internet.MimeMultipart content, javax.mail.internet.MimeMultipart textPart) throws javax.mail.MessagingException
javax.mail.MessagingException
protected void assignRecipient(javax.mail.Message.RecipientType type, java.lang.String addresses, javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
javax.mail.MessagingException
protected java.lang.Iterable<java.lang.String> splitAddresses(java.lang.String addresses)
protected void assignFromAddress(SendingMessage sendingMessage, javax.mail.internet.MimeMessage msg) throws javax.mail.MessagingException
javax.mail.MessagingException
protected javax.mail.internet.MimeBodyPart createAttachmentPart(SendingAttachment attachment) throws javax.mail.MessagingException
javax.mail.MessagingException
protected java.lang.String generateAttachmentContentId(java.lang.String attachmentName)