public class SimpleEmailServiceJavaMailSender extends SimpleEmailServiceMailSender implements 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 |
---|---|
MimeMessage |
createMimeMessage() |
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 Session |
getSession()
Return the JavaMail
Session , lazily initializing it if hasn't been
specified explicitly. |
void |
send(MimeMessage... mimeMessages) |
void |
send(MimeMessage mimeMessage) |
void |
send(MimeMessagePreparator... mimeMessagePreparators) |
void |
send(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(Session session)
Set the JavaMail
Session , possibly pulled from JNDI. |
destroy, getEmailService, send, send
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
send, send
public 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 Session getSession()
Session
, lazily initializing it if hasn't been
specified explicitly.public void setSession(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 MimeMessage createMimeMessage()
createMimeMessage
in interface JavaMailSender
public MimeMessage createMimeMessage(InputStream contentStream) throws MailException
createMimeMessage
in interface JavaMailSender
MailException
public void send(MimeMessage mimeMessage) throws MailException
send
in interface JavaMailSender
MailException
public void send(MimeMessage... mimeMessages) throws MailException
send
in interface JavaMailSender
MailException
public void send(MimeMessagePreparator mimeMessagePreparator) throws MailException
send
in interface JavaMailSender
MailException
public void send(MimeMessagePreparator... mimeMessagePreparators) throws MailException
send
in interface JavaMailSender
MailException
Copyright © 2022 Pivotal Software, Inc.. All rights reserved.