@FunctionalInterface
public interface MimeMessagePreparator
The corresponding send
methods of JavaMailSender
will take care of the actual creation of a MimeMessage
instance,
and of proper exception conversion.
It is often convenient to use a MimeMessageHelper
for populating
the passed-in MimeMessage, in particular when working with attachments or
special character encodings.
See MimeMessageHelper's javadoc
for an example.
JavaMailSender.send(MimeMessagePreparator)
,
JavaMailSender.send(MimeMessagePreparator[])
,
MimeMessageHelper
Modifier and Type | Method and Description |
---|---|
void |
prepare(MimeMessage mimeMessage)
Prepare the given new MimeMessage instance.
|
void prepare(MimeMessage mimeMessage) throws java.lang.Exception
mimeMessage
- the message to prepareMessagingException
- passing any exceptions thrown by MimeMessage
methods through for automatic conversion to the MailException hierarchyjava.io.IOException
- passing any exceptions thrown by MimeMessage methods
through for automatic conversion to the MailException hierarchyjava.lang.Exception
- if mail preparation failed, for example when a
FreeMarker template cannot be rendered for the mail text