An email is defined as a simple POJO bean of type
Text and HTML email, high priority:
All email addresses (from, to, cc...) may be specified in the following ways:
- by separate personal (display) name and email address
- by providing
EmailAddress, a class that parses and validates emails per specification
- by providing
Consider using personal names as it is less likely your message is going to be marked as spam ;)
Multiple email addresses are specified using arrays or by calling methods
There are several attachment types that can be added:
- from a memory byte array,
- from an input stream,
- from a file,
- from generic
File attachments depend on
javax.mailcontent type resolution (that might not work for you). You can always attach files as byte or input stream attachment.
Attachments are created using the
content()method accepts different attachment types.
A special case of attachments is inline attachments. These are usually related content for HTML message, like images, that should appear inside the message, and not separate as a real attachment.
Embedding is also supported. All attachments created with the
ContentIDset will be considered as inline attachments. However, they also need to be embedded to a certain message, to form a so-called related part of an email. Email clients usually require to have all inline attachments related to some message.
Email email = Email.create()
"<html><META http-equiv=Content-Type content=\"text/html; " +
"charset=utf-8\"><body><h1>Hey!</h1><img src='cid:c.png'>" +