Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

EmailFileAttachment Class

EmailFileAttachment is used in SingleEmailMessage to specify attachments passed in as part of the request, as opposed to existing documents in Salesforce.

Namespace

Messaging

Usage

Sending an email by using Apex requires domain-level and user-level email verification. System-generated emails also require verification of the From email address. Email delivery fails if any of these verifications is incomplete. See Requirements to Send Email from Salesforce.

Important

EmailFileAttachment Constructors

The following are constructors for EmailFileAttachment.

EmailFileAttachment()

Creates a new instance of the Messaging.EmailFileAttachment class.

Signature

public EmailFileAttachment()

EmailFileAttachment Properties

The following are properties for EmailFileAttachment.

body

Gets or sets the attachment itself.

Signature

public Blob body {get; set;}

Property Value

Type: Blob

contenttype

Gets or sets the attachment's Content-Type.

Signature

public String contenttype {get; set;}

Property Value

Type: String

filename

Gets or sets the name of the file to attach.

Signature

public String filename {get; set;}

Property Value

Type: String

id

Read-Only. Gets the attachment ID.

Signature

public Id id {get;}

Property Value

Type: Id

inline

Specifies a Content-Disposition of inline (true) or attachment (false).

Signature

public Boolean inline {get; set;}

Property Value

Type: Boolean