Constructing a message

Message is an abstract class in the JavaMail API. Subclasses of Message implement the concrete functionality needed for specific messaging systems. The JavaMail reference implementation includes a MimeMessage class that implements the standard for basic Internet messages and the Multipurpose Internet Mail Extensions.

To construct a message, instantiate a MimeMessage object, set the required attributes (headers), and provide the appropriate header values and body content. At a minimum, you should specify the From, To, and Date headers.

Use the setFrom method to set the From header field using the value of InternetAddress. Use the setRecipients method to set the specified recipient type to a given address. Use the setSentDate method to set the date.