Newer Version Available

This content describes an older version of this product. View Latest

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

EmailFileAttachment Constructors

The following are constructors for EmailFileAttachment.

EmailFileAttachment()

Creates a new instance of the Messaging.EmailFileAttachment class.

Signature

public EmailFileAttachment()

EmailFileAttachment Methods

The following are methods for EmailFileAttachment. All are instance methods.

setBody(Blob)

Sets the attachment itself.

Signature

public Void setBody(Blob attachment)

Parameters

attachment
Type: Blob

Return Value

Type: Void

setContentType(String)

Sets the attachment's Content-Type.

Signature

public Void setContentType(String content_type)

Parameters

content_type
Type: String

Return Value

Type: Void

setFileName(String)

Sets the name of the file to attach.

Signature

public Void setFileName(String file_name)

Parameters

file_name
Type: String

Return Value

Type: Void

setInline(Boolean)

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

Signature

public Void setInline(Boolean Content-Disposition)

Parameters

Content-Disposition
Type: Boolean

Return Value

Type: Void

Usage

In most cases, inline content is displayed to the user when the message is opened. Attachment content requires user action to be displayed.