public class SimpleEmailServiceJavaMailSender extends SimpleEmailServiceMailSender implements org.springframework.mail.javamail.JavaMailSender
JavaMailSender implementation that allows to send MimeMessage using the
Simple E-Mail Service. In contrast to SimpleEmailServiceMailSender this class
also allows the use of attachment and other mime parts inside mail messages.| Constructor and Description |
|---|
SimpleEmailServiceJavaMailSender(com.amazonaws.services.simpleemail.AmazonSimpleEmailService amazonSimpleEmailService) |
| Modifier and Type | Method and Description |
|---|---|
javax.mail.internet.MimeMessage |
createMimeMessage() |
javax.mail.internet.MimeMessage |
createMimeMessage(InputStream contentStream) |
protected Properties |
getJavaMailProperties()
Allow Map access to the JavaMail properties of this sender, with the option to add
or override specific entries.
|
protected javax.mail.Session |
getSession()
Return the JavaMail
Session, lazily initializing it if hasn't been
specified explicitly. |
void |
send(javax.mail.internet.MimeMessage... mimeMessages) |
void |
send(javax.mail.internet.MimeMessage mimeMessage) |
void |
send(org.springframework.mail.javamail.MimeMessagePreparator... mimeMessagePreparators) |
void |
send(org.springframework.mail.javamail.MimeMessagePreparator mimeMessagePreparator) |
void |
setDefaultEncoding(String defaultEncoding)
Set the default encoding to use for
MimeMessages created by
this instance. |
void |
setDefaultFileTypeMap(FileTypeMap defaultFileTypeMap)
Set the default Java Activation
FileTypeMap to use for MimeMessages created by this instance. |
void |
setJavaMailProperties(Properties javaMailProperties)
Set JavaMail properties for the
Session. |
void |
setSession(javax.mail.Session session)
Set the JavaMail
Session, possibly pulled from JNDI. |
destroy, getEmailService, send, sendpublic SimpleEmailServiceJavaMailSender(com.amazonaws.services.simpleemail.AmazonSimpleEmailService amazonSimpleEmailService)
protected Properties getJavaMailProperties()
Useful for specifying entries directly, for example via "javaMailProperties[mail.from]".
public void setJavaMailProperties(Properties javaMailProperties)
Session.
A new Session will be created with those properties.
Non-default properties in this instance will override given JavaMail properties.
javaMailProperties - java mail propsprotected javax.mail.Session getSession()
Session, lazily initializing it if hasn't been
specified explicitly.public void setSession(javax.mail.Session session)
Session, possibly pulled from JNDI.
Default is a new Session without defaults, that is completely configured
via this instance's properties.
If using a pre-configured Session, non-default properties in this instance
will override the settings in the Session.
session - JavaMail sessionsetJavaMailProperties(java.util.Properties)public void setDefaultEncoding(String defaultEncoding)
MimeMessages created by
this instance.
Such an encoding will be auto-detected by MimeMessageHelper.
defaultEncoding - default encoding for mime messagespublic void setDefaultFileTypeMap(FileTypeMap defaultFileTypeMap)
FileTypeMap to use for MimeMessages created by this instance.
A FileTypeMap specified here will be autodetected by
MimeMessageHelper, avoiding the need to specify the FileTypeMap for
each MimeMessageHelper instance.
For example, you can specify a custom instance of Spring's
ConfigurableMimeFileTypeMap here. If not explicitly specified, a default
ConfigurableMimeFileTypeMap will be used, containing an extended set of
MIME type mappings (as defined by the mime.types file contained in the
Spring jar).
defaultFileTypeMap - Java Activation file type mapMimeMessageHelper.setFileTypeMap(javax.activation.FileTypeMap)public javax.mail.internet.MimeMessage createMimeMessage()
createMimeMessage in interface org.springframework.mail.javamail.JavaMailSenderpublic javax.mail.internet.MimeMessage createMimeMessage(InputStream contentStream) throws org.springframework.mail.MailException
createMimeMessage in interface org.springframework.mail.javamail.JavaMailSenderorg.springframework.mail.MailExceptionpublic void send(javax.mail.internet.MimeMessage mimeMessage)
throws org.springframework.mail.MailException
send in interface org.springframework.mail.javamail.JavaMailSenderorg.springframework.mail.MailExceptionpublic void send(javax.mail.internet.MimeMessage... mimeMessages)
throws org.springframework.mail.MailException
send in interface org.springframework.mail.javamail.JavaMailSenderorg.springframework.mail.MailExceptionpublic void send(org.springframework.mail.javamail.MimeMessagePreparator mimeMessagePreparator)
throws org.springframework.mail.MailException
send in interface org.springframework.mail.javamail.JavaMailSenderorg.springframework.mail.MailExceptionpublic void send(org.springframework.mail.javamail.MimeMessagePreparator... mimeMessagePreparators)
throws org.springframework.mail.MailException
send in interface org.springframework.mail.javamail.JavaMailSenderorg.springframework.mail.MailExceptionCopyright © 2021 Pivotal Software, Inc.. All rights reserved.