org.springframework.mail.javamail
Class JavaMailSenderImpl


public class JavaMailSenderImpl
implements JavaMailSender

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.

Author:
Dmitriy Kopylenko, Juergen Hoeller
Version: $Id: JavaMailSenderImpl.java,v 1.8 2004/01/26 17:05:00 jhoeller Exp $
See Also: JavaMailSender, MailSender

Field Summary
 final static intDEFAULT_PORT
           
 final static StringDEFAULT_PROTOCOL
           

Method Summary
 MimeMessagecreateMimeMessage()
           
 voidsend(SimpleMailMessage simpleMessage)
           
 voidsend(SimpleMailMessage[] simpleMessages)
           
 voidsend(MimeMessage mimeMessage)
           
 voidsend(MimeMessage[] mimeMessages)
           
 voidsend(MimeMessage[] mimeMessages, Object[] originalMessages)
           
 voidsend(MimeMessagePreparator mimeMessagePreparator)
           
 voidsend(MimeMessagePreparator[] mimeMessagePreparators)
           
 voidsetHost(String host)
          Set the mail server host, typically an SMTP host.
 voidsetPassword(String password)
          Set the password for the account at the mail host, if any.
 voidsetPort(int port)
          Set the mail server port.
 voidsetProtocol(String protocol)
          Set the mail protocol.
 voidsetSession(Session session)
          Set the JavaMail Session, possibly pulled from JNDI.
 voidsetUsername(String username)
          Set the username for the account at the mail host, if any.

Field Detail

DEFAULT_PORT

public final static int DEFAULT_PORT

DEFAULT_PROTOCOL

public final static String DEFAULT_PROTOCOL
Method Detail

createMimeMessage

public MimeMessage createMimeMessage()

send

public void send(SimpleMailMessage simpleMessage)
throws org.springframework.mail.MailException

send

public void send(SimpleMailMessage[] simpleMessages)
throws org.springframework.mail.MailException

send

public void send(MimeMessage mimeMessage)
throws org.springframework.mail.MailException

send

public void send(MimeMessage[] mimeMessages)
throws org.springframework.mail.MailException

send

public void send(MimeMessage[] mimeMessages, Object[] originalMessages)
throws org.springframework.mail.MailException

send

public void send(MimeMessagePreparator mimeMessagePreparator)
throws org.springframework.mail.MailException

send

public void send(MimeMessagePreparator[] mimeMessagePreparators)
throws org.springframework.mail.MailException

setHost

public void setHost(String host)
Set the mail server host, typically an SMTP host.

setPassword

public void setPassword(String password)
Set the password for the account at the mail host, if any.

setPort

public void setPort(int port)
Set the mail server port. Default is 25.

setProtocol

public void setProtocol(String protocol)
Set the mail protocol. Default is SMTP.

setSession

public void setSession(Session session)
Set the JavaMail Session, possibly pulled from JNDI. Default is an new Session without defaults, i.e. completely configured via this object's properties.

If using a pre-configured Session, non-default properties in this object will override the settings in the Session.


setUsername

public void setUsername(String username)
Set the username for the account at the mail host, if any.

Association Links

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String