Top Description Methods
org.springframework.mail.javamail

public Interface MimeMessagePreparator

Annotations
@FunctionalInterface
Imports
jakarta.mail.internet.MimeMessage

Callback interface for the preparation of JavaMail MIME messages.

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.

Author
Juergen Hoeller
Since
07.10.2003
See Also
JavaMailSender#send(MimeMessagePreparator), JavaMailSender#send(MimeMessagePreparator[]), MimeMessageHelper

Method Summary

Modifier and TypeMethod and Description
public void
prepare(MimeMessage
the message to prepare
mimeMessage
)

Prepare the given new MimeMessage instance.

Method Detail

prepareback to summary
public void prepare(MimeMessage mimeMessage) throws Exception

Prepare the given new MimeMessage instance.

Parameters
mimeMessage:MimeMessage

the message to prepare

Exceptions
Exception:
if mail preparation failed, for example when a FreeMarker template cannot be rendered for the mail text
MessagingException:
passing any exceptions thrown by MimeMessage methods through for automatic conversion to the MailException hierarchy
IOException:
passing any exceptions thrown by MimeMessage methods through for automatic conversion to the MailException hierarchy