Various constructors for parsing an email message.
Allows access to the headers in the email as a key/value hash.
Returns the message body as either HTML or text. Gives the same results as through the parent interface, EmailMessage.htmlBody and EmailMessage.textBody.
Convenience method that takes a filename instead of the content.
Returns the message body as either HTML or text. Gives the same results as through the parent interface, EmailMessage.htmlBody and EmailMessage.textBody.
Adds a custom header to the message. The header name should not include a colon and must not duplicate a header set elsewhere in the class; for example, do not use this to set To, and instead use the to field.
Recipients of the message. You can use operator ~= to add people to this list, or you can also use addRecipient to achieve the same result.
Represents the From: and Reply-To: header values in the email.
The Subject: header value in the email.
The In-Reply-to: header value. This should be set to the same value as the Message-ID header from the message you're replying to.
Gets and sets the current text body.
Gets the current html body, if any.
If you use the send method with an SMTP server, you don't want to change this. While RFC 2045 mandates CRLF as a lineseperator, there are some edge-cases where this won't work. When passing the E-Mail string to a unix program which handles communication with the SMTP server, some (i.e. qmail) expect the system lineseperator (LF) instead. Notably, the google mail REST API will choke on CRLF lineseps and produce strange emails (as of 2024).
Sets the plain text body of the email. You can also separately call setHtmlBody to set a HTML body.
Sets the HTML body to the mail, which can support rich text, inline images (see addInlineImage), etc.
The filename is what is shown to the user, not the file on your sending computer. It should NOT have a path in it.
in the html, use img src="cid:ID_GIVEN_HERE"
Returns the MIME formatted email string, including encoded attachments
Sends via a given SMTP relay
Represents a single email from an incoming or saved source consisting of the raw data. Such saved sources include mbox files (which are several concatenated together, see MboxMessages for a full reader of these files), .eml files, and Maildir entries.