| java.lang.Object org.springframework.mail.javamail.JavaMailSenderImpl
Constructor Summary | |
public | JavaMailSenderImpl() Create a new instance of the JavaMailSenderImpl class. |
Method Summary | |
public MimeMessage | createMimeMessage() This implementation creates a SmartMimeMessage, holding the specified
default encoding and default FileTypeMap. | public MimeMessage | createMimeMessage(InputStream contentStream) | protected void | doSend(MimeMessage[] mimeMessages, Object[] originalMessages) Actually send the given array of MimeMessages via JavaMail. | public String | getDefaultEncoding() Return the default encoding for
MimeMessage MimeMessages ,
or null if none. | public FileTypeMap | getDefaultFileTypeMap() Return the default Java Activation
FileTypeMap for
MimeMessage MimeMessages , or null if none. | public String | getHost() Return the mail server host. | public Properties | getJavaMailProperties() Allow Map access to the JavaMail properties of this sender,
with the option to add or override specific entries. | public String | getPassword() Return the password for the account at the mail host. | public int | getPort() Return the mail server port. | public String | getProtocol() Return the mail protocol. | public synchronized Session | getSession() Return the JavaMail Session ,
lazily initializing it if hasn't been specified explicitly. | protected Transport | getTransport(Session session) Obtain a Transport object from the given JavaMail Session,
using the configured protocol.
Can be overridden in subclasses, e.g. | public String | getUsername() Return the username for the account at the mail host. | public void | send(SimpleMailMessage simpleMessage) | public void | send(SimpleMailMessage[] simpleMessages) | public void | send(MimeMessage mimeMessage) | public void | send(MimeMessage[] mimeMessages) | public void | send(MimeMessagePreparator mimeMessagePreparator) | public void | send(MimeMessagePreparator[] mimeMessagePreparators) | public void | setDefaultEncoding(String defaultEncoding) Set the default encoding to use for
MimeMessage MimeMessages created by this instance. | public void | setDefaultFileTypeMap(FileTypeMap defaultFileTypeMap) Set the default Java Activation
FileTypeMap to use for
MimeMessage 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. | public void | setHost(String host) Set the mail server host, typically an SMTP host. | public void | setJavaMailProperties(Properties javaMailProperties) Set JavaMail properties for the Session . | public void | setPassword(String password) Set the password for the account at the mail host, if any.
Note that the underlying JavaMail Session has to be
configured with the property "mail.smtp.auth" set to
true , else the specified password will not be sent to the
mail server by the JavaMail runtime. | public void | setPort(int port) Set the mail server port. | public void | setProtocol(String protocol) Set the mail protocol. | public synchronized void | setSession(Session session) Set the JavaMail Session , possibly pulled from JNDI. | public void | setUsername(String username) Set the username for the account at the mail host, if any.
Note that the underlying JavaMail Session has to be
configured with the property "mail.smtp.auth" set to
true , else the specified username will not be sent to the
mail server by the JavaMail runtime. |
DEFAULT_PORT | final public static int DEFAULT_PORT(Code) | | The default port: -1
|
DEFAULT_PROTOCOL | final public static String DEFAULT_PROTOCOL(Code) | | The default protocol: 'smtp'
|
doSend | protected void doSend(MimeMessage[] mimeMessages, Object[] originalMessages) throws MailException(Code) | | Actually send the given array of MimeMessages via JavaMail.
Parameters: mimeMessages - MimeMessage objects to send Parameters: originalMessages - corresponding original message objectsthat the MimeMessages have been created from (with same arraylength and indices as the "mimeMessages" array), if any throws: org.springframework.mail.MailAuthenticationException - in case of authentication failure throws: org.springframework.mail.MailSendException - in case of failure when sending a message |
getDefaultEncoding | public String getDefaultEncoding()(Code) | | Return the default encoding for
MimeMessage MimeMessages ,
or null if none.
|
getDefaultFileTypeMap | public FileTypeMap getDefaultFileTypeMap()(Code) | | Return the default Java Activation
FileTypeMap for
MimeMessage MimeMessages , or null if none.
|
getHost | public String getHost()(Code) | | Return the mail server host.
|
getJavaMailProperties | public Properties getJavaMailProperties()(Code) | | Allow Map access to the JavaMail properties of this sender,
with the option to add or override specific entries.
Useful for specifying entries directly, for example via
"javaMailProperties[mail.smtp.auth]".
|
getPassword | public String getPassword()(Code) | | Return the password for the account at the mail host.
|
getPort | public int getPort()(Code) | | Return the mail server port.
|
getProtocol | public String getProtocol()(Code) | | Return the mail protocol.
|
getSession | public synchronized Session getSession()(Code) | | Return the JavaMail Session ,
lazily initializing it if hasn't been specified explicitly.
|
getTransport | protected Transport getTransport(Session session) throws NoSuchProviderException(Code) | | Obtain a Transport object from the given JavaMail Session,
using the configured protocol.
Can be overridden in subclasses, e.g. to return a mock Transport object.
See Also: javax.mail.Session.getTransport(String) See Also: JavaMailSenderImpl.getProtocol() |
getUsername | public String getUsername()(Code) | | Return the username for the account at the mail host.
|
setDefaultEncoding | public void setDefaultEncoding(String defaultEncoding)(Code) | | Set the default encoding to use for
MimeMessage MimeMessages created by this instance.
Such an encoding will be auto-detected by
MimeMessageHelper .
|
setDefaultFileTypeMap | public void setDefaultFileTypeMap(FileTypeMap defaultFileTypeMap)(Code) | | Set the default Java Activation
FileTypeMap to use for
MimeMessage 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).
See Also: MimeMessageHelper.setFileTypeMap |
setHost | public void setHost(String host)(Code) | | Set the mail server host, typically an SMTP host.
Default is the default host of the underlying JavaMail Session.
|
setJavaMailProperties | public void setJavaMailProperties(Properties javaMailProperties)(Code) | | Set JavaMail properties for the Session .
A new Session will be created with those properties.
Use either this method or
JavaMailSenderImpl.setSession , but not both.
Non-default properties in this instance will override given
JavaMail properties.
|
setProtocol | public void setProtocol(String protocol)(Code) | | Set the mail protocol. Default is "smtp".
|
setSession | public synchronized void setSession(Session session)(Code) | | Set the JavaMail 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 .
See Also: JavaMailSenderImpl.setJavaMailProperties |
|
|