Class Email

Class for representing and sending emails.

Examples

Email e;

e.setValue("from", "bob@example.com");
e.setValue("to", "allice@example.com");
e.setValue("to", "simon@example.com"); // Value must be set once for each recipient
e.setValue("subject", "test");
e.setValue("body", "This is a test.");

Constructors

Email()

Initializes a new instance of the Email class.

Declaration

Email

Examples

Email e;

e.setValue("from", "bob@example.com");
e.setValue("to", "allice@example.com");
e.setValue("to", "simon@example.com"); // Value must be set once for each recipient
e.setValue("subject", "test");
e.setValue("body", "This is a test.");

Methods

addAttachment(Integer,Bool)

Adds an attachment to the email object.

Declaration

String addAttachment(Integer attachmentId, Bool inline)

Parameters

Type Name Description
Integer attachmentId The database ID of the attachment to include inline Set to true if you want to show the attachment inside the mail (used mostly for images).
Bool inline If true, attachments will be inlined in the email body.

Returns

Type Description
String The ID of the attachment relative to the email.

send()

Sends the email.

Declaration

Void send()

Returns

Type Description
Void

setValue(String,String)

Sets the value of the given field in the email instance.

For multiple recipients, call setValue multiple times, once for each recipient.

Declaration

Void setValue(String name, String value)

Parameters

Type Name Description
String name The name of the field.
String value The value to set.

Returns

Type Description
Void