open class JavaMailSenderImpl : JavaMailSender
Production implementation of the JavaMailSender interface, supporting both JavaMail MimeMessage and Spring SimpleMailMessage. Can also be used as a plain org.springframework.mail.MailSender implementation.
Allows for defining all settings locally as bean properties. Alternatively, a pre-configured JavaMail javax.mail.Session can be specified, possibly pulled from an application server's JNDI environment.
Non-default properties in this object will always override the settings in the JavaMail Session
. Note that if overriding all values locally, there is no added value in setting a pre-configured Session
.
Author
Dmitriy Kopylenko
Author
Juergen Hoeller
Since
10.09.2003
See Also
javax.mail.internet.MimeMessagejavax.mail.Session#setSession#setJavaMailProperties#setHost#setPort#setUsername#setPassword
JavaMailSenderImpl()
Create a new instance of the Initializes the |
static val DEFAULT_PORT: Int
The default port: -1 |
|
static val DEFAULT_PROTOCOL: String
The default protocol: 'smtp' |
open fun createMimeMessage(): MimeMessage
This implementation creates a SmartMimeMessage, holding the specified default encoding and default FileTypeMap. This special defaults-carrying message will be autodetected by MimeMessageHelper, which will use the carried encoding and FileTypeMap unless explicitly overridden. open fun createMimeMessage(contentStream: InputStream): MimeMessage |
|
open fun getDefaultEncoding(): String
Return the default encoding for MimeMessage, or |
|
open fun getDefaultFileTypeMap(): FileTypeMap
Return the default Java Activation FileTypeMap for MimeMessage, or |
|
open fun getHost(): String
Return the mail server host. |
|
open fun getJavaMailProperties(): Properties
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]". |
|
open fun getPassword(): String
Return the password for the account at the mail host. |
|
open fun getPort(): Int
Return the mail server port. |
|
open fun getProtocol(): String
Return the mail protocol. |
|
open fun getSession(): Session
Return the JavaMail |
|
open fun getUsername(): String
Return the username for the account at the mail host. |
|
open fun send(simpleMessage: SimpleMailMessage): Unit open fun send(vararg simpleMessages: SimpleMailMessage): Unit open fun send(mimeMessage: MimeMessage): Unit open fun send(vararg mimeMessages: MimeMessage): Unit open fun send(mimeMessagePreparator: MimeMessagePreparator): Unit open fun send(vararg mimeMessagePreparators: MimeMessagePreparator): Unit |
|
open fun setDefaultEncoding(defaultEncoding: String): Unit
Set the default encoding to use for MimeMessage created by this instance. Such an encoding will be auto-detected by MimeMessageHelper. |
|
open fun setDefaultFileTypeMap(defaultFileTypeMap: FileTypeMap): Unit
Set the default Java Activation FileTypeMap to use for MimeMessage created by this instance. A For example, you can specify a custom instance of Spring's ConfigurableMimeFileTypeMap here. If not explicitly specified, a default |
|
open fun setHost(host: String): Unit
Set the mail server host, typically an SMTP host. Default is the default host of the underlying JavaMail Session. |
|
open fun setJavaMailProperties(javaMailProperties: Properties): Unit
Set JavaMail properties for the A new Non-default properties in this instance will override given JavaMail properties. |
|
open fun setPassword(password: String): Unit
Set the password for the account at the mail host, if any. Note that the underlying JavaMail |
|
open fun setPort(port: Int): Unit
Set the mail server port. Default is |
|
open fun setProtocol(protocol: String): Unit
Set the mail protocol. Default is "smtp". |
|
open fun setSession(session: Session): Unit
Set the JavaMail Default is a new If using a pre-configured |
|
open fun setUsername(username: String): Unit
Set the username for the account at the mail host, if any. Note that the underlying JavaMail |
|
open fun testConnection(): Unit
Validate that this instance can connect to the server that it is configured for. Throws a MessagingException if the connection attempt failed. |