|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.mail.javamail.JavaMailSenderImpl
Implementation of the JavaMailSender interface. Can also be used as plain MailSender implementation.
Allows for defining all settings locally as bean properties. Alternatively, a pre-configured JavaMail 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 value in setting a pre-configured Session.
JavaMailSender
,
MailSender
Field Summary | |
static int |
DEFAULT_PORT
|
static java.lang.String |
DEFAULT_PROTOCOL
|
protected org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
JavaMailSenderImpl()
|
Method Summary | |
javax.mail.internet.MimeMessage |
createMimeMessage()
Create a new JavaMail MimeMessage for the underlying JavaMail Session of this sender. |
protected javax.mail.Transport |
getTransport(javax.mail.Session session)
Get a Transport object for the given JavaMail Session. |
void |
send(javax.mail.internet.MimeMessage mimeMessage)
Send the given JavaMail MIME message. |
void |
send(javax.mail.internet.MimeMessage[] mimeMessages)
Send the given array of JavaMail MIME messages in batch. |
void |
send(javax.mail.internet.MimeMessage[] mimeMessages,
java.lang.Object[] originalMessages)
|
void |
send(MimeMessagePreparator mimeMessagePreparator)
Send the JavaMail MIME message prepared by the given MimeMessagePreparator. |
void |
send(MimeMessagePreparator[] mimeMessagePreparators)
Send the JavaMail MIME messages prepared by the given MimeMessagePreparators. |
void |
send(SimpleMailMessage simpleMessage)
Send the given simple mail message. |
void |
send(SimpleMailMessage[] simpleMessages)
Send the given array of simple mail messages in batch. |
void |
setHost(java.lang.String host)
Set the mail server host, typically an SMTP host. |
void |
setJavaMailProperties(java.util.Properties javaMailProperties)
Set JavaMail properties for the Session. |
void |
setPassword(java.lang.String password)
Set the password for the account at the mail host, if any. |
void |
setPort(int port)
Set the mail server port. |
void |
setProtocol(java.lang.String protocol)
Set the mail protocol. |
void |
setSession(javax.mail.Session session)
Set the JavaMail Session, possibly pulled from JNDI. |
void |
setUsername(java.lang.String username)
Set the username for the account at the mail host, if any. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DEFAULT_PROTOCOL
public static final int DEFAULT_PORT
protected final org.apache.commons.logging.Log logger
Constructor Detail |
public JavaMailSenderImpl()
Method Detail |
public void setSession(javax.mail.Session session)
If using a pre-configured Session, non-default properties in this MailSender will override the settings in the Session.
setJavaMailProperties(java.util.Properties)
public void setJavaMailProperties(java.util.Properties javaMailProperties)
Non-default properties in this MailSender will override given JavaMail properties.
setSession(javax.mail.Session)
public void setProtocol(java.lang.String protocol)
public void setHost(java.lang.String host)
public void setPort(int port)
public void setUsername(java.lang.String username)
public void setPassword(java.lang.String password)
public void send(SimpleMailMessage simpleMessage) throws MailException
MailSender
send
in interface MailSender
simpleMessage
- message to send
MailException
- in case of message, authentication or send errorspublic void send(SimpleMailMessage[] simpleMessages) throws MailException
MailSender
send
in interface MailSender
simpleMessages
- messages to send
MailException
- in case of message, authentication or send errorspublic javax.mail.internet.MimeMessage createMimeMessage()
JavaMailSender
createMimeMessage
in interface JavaMailSender
JavaMailSender.send(MimeMessage)
,
JavaMailSender.send(MimeMessage[])
public void send(javax.mail.internet.MimeMessage mimeMessage) throws MailException
JavaMailSender
send
in interface JavaMailSender
mimeMessage
- message to send
MailException
- in case of message, authentication or send errorsJavaMailSender.createMimeMessage()
public void send(javax.mail.internet.MimeMessage[] mimeMessages) throws MailException
JavaMailSender
send
in interface JavaMailSender
mimeMessages
- messages to send
MailException
- in case of message, authentication or send errorsJavaMailSender.createMimeMessage()
public void send(javax.mail.internet.MimeMessage[] mimeMessages, java.lang.Object[] originalMessages) throws MailException
MailException
public void send(MimeMessagePreparator mimeMessagePreparator) throws MailException
JavaMailSender
send
in interface JavaMailSender
mimeMessagePreparator
- the preparator to use
MailException
- in case of message, authentication or send errorspublic void send(MimeMessagePreparator[] mimeMessagePreparators) throws MailException
JavaMailSender
send
in interface JavaMailSender
mimeMessagePreparators
- the preparator to use
MailException
- in case of message, authentication or send errorsprotected javax.mail.Transport getTransport(javax.mail.Session session) throws javax.mail.NoSuchProviderException
javax.mail.NoSuchProviderException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |