|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface JavaMailSender
Extended MailSender interface for JavaMail, supporting MIME messages both as direct arguments and through preparation callbacks. Typically used in conjunction with the MimeMessageHelper class for convenient creation of JavaMail MimeMessages, including attachments etc.
Clients should talk to the mail sender through this interface if they need mail functionality beyond SimpleMailMessage. The production implementation is JavaMailSenderImpl. Clients will typically receive the mail sender reference through dependency injection.
The recommended way of using this interface is the MimeMessagePreparator mechanism, possibly using a MimeMessageHelper for populating the message. See MimeMessageHelper's javadoc for an example.
Not as easy to test as a plain MailSender, but still rather easy compared to
traditional JavaMail code: Just let createMimeMessage
return a plain
MimeMessage created with a Session.getInstance(new Properties())
call, and check the given messages in your mock implementations of the various
send methods.
JavaMailSenderImpl
,
createMimeMessage()
,
MimeMessagePreparator
,
MimeMessageHelper
,
SimpleMailMessage
Method Summary | |
---|---|
MimeMessage |
createMimeMessage()
Create a new JavaMail MimeMessage for the underlying JavaMail Session of this sender. |
MimeMessage |
createMimeMessage(InputStream contentStream)
Create a new JavaMail MimeMessage for the underlying JavaMail Session of this sender, using the given input stream as the message source. |
void |
send(MimeMessage mimeMessage)
Send the given JavaMail MIME message. |
void |
send(MimeMessage[] mimeMessages)
Send the given array of JavaMail MIME messages in batch. |
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. |
Methods inherited from interface org.springframework.mail.MailSender |
---|
send, send |
Method Detail |
---|
MimeMessage createMimeMessage()
send(MimeMessage)
,
send(MimeMessage[])
MimeMessage createMimeMessage(InputStream contentStream) throws MailException
contentStream
- the raw MIME input stream for the message
MailParseException
- in case of message creation failure
MailException
void send(MimeMessage mimeMessage) throws MailException
mimeMessage
- message to send
MailAuthenticationException
- in case of authentication failure
MailSendException
- in case of failure when sending the message
MailException
createMimeMessage()
void send(MimeMessage[] mimeMessages) throws MailException
mimeMessages
- messages to send
MailAuthenticationException
- in case of authentication failure
MailSendException
- in case of failure when sending a message
MailException
createMimeMessage()
void send(MimeMessagePreparator mimeMessagePreparator) throws MailException
mimeMessagePreparator
- the preparator to use
MailPreparationException
- in case of failure when preparing the message
MailParseException
- in case of failure when parsing the message
MailAuthenticationException
- in case of authentication failure
MailSendException
- in case of failure when sending the message
MailException
void send(MimeMessagePreparator[] mimeMessagePreparators) throws MailException
mimeMessagePreparators
- the preparator to use
MailPreparationException
- in case of failure when preparing a message
MailParseException
- in case of failure when parsing a message
MailAuthenticationException
- in case of authentication failure
MailSendException
- in case of failure when sending a message
MailException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |