\google\appengine\api\mail\BaseMessage

ABSTRACT   

Abstract base class for sending mail using the App Engine mail APIs.

Methods

send

ABSTRACT   

send()

__construct

__construct(array $options = null)

Construct an instance of Message.

Parameters

Name Description

$options

array

Options for message content, key as per set_functions shown above, value to be set.

Throws

\InvalidArgumentException

If the options variable passed was not an array, if an invalid option was set in the options array, or if a value to be set by the options array was invalid.

addAttachment

addAttachment(string $filename, mixed $data, string $content_id = null)

Adds an attachment to the Message object.

Parameters

Name Description

$filename

string

Filename of the attachment.

$data

mixed

File data of the attachment.

$content_id

string

Optional Content-ID header value of the attachment. Must be enclosed by angle brackets (<>).

Throws

\InvalidArgumentException

If the input is not an array or if the attachment type is invalid (i.e. the filename is not a string, or the file extension is blacklisted).

addAttachmentArray

addAttachmentArray( $attach_array)

Adds an array of attachments to the Message object.

Parameters

Name Description

$attach_array

Throws

\InvalidArgumentException

If the input is not an array or if the attachment type is invalid (i.e. the filename is not a string, or the file extension is blacklisted).

addAttachmentsArray

addAttachmentsArray( $attach_array)

Adds an array of attachments to the Message object.

Parameters

Name Description

$attach_array

Throws

\InvalidArgumentException

If the input is not an array or if the attachment type is invalid (i.e. the filename is not a string, or the file extension is blacklisted).

addHeader

addHeader(string $key, string $value)

Adds a header pair to the mail object.

Parameters

Name Description

$key

string

Header name (from the whitelist) to be added.

$value

string

Header value to be added.

Throws

\InvalidArgumentException

If the header is not on the whitelist, or if the header is invalid (i.e. not a string).

addHeaderArray

addHeaderArray( $header_array)

Adds an array of headers to the mail object.

Parameters

Name Description

$header_array

Throws

\InvalidArgumentException

If the input is not an array, or if headers are not on the whitelist, or if a header is invalid (i.e. not a string).

clearAttachments

clearAttachments()

Clear all attachments from the mail object.

clearHeaders

clearHeaders()

Clear all headers from the mail object.

setHtmlBody

setHtmlBody(string $text)

Sets HTML content for the email body.

Parameters

Name Description

$text

string

HTML to add.

Throws

\InvalidArgumentException

If text is not a string.

setReplyTo

setReplyTo(string $email)

Sets a reply-to address for the mail object.

Parameters

Name Description

$email

string

Reply-to address.

Throws

\InvalidArgumentException

If the input reply-to address is an invalid email address.

setSender

setSender(string $email)

Sets the sender for the mail object.

Parameters

Name Description

$email

string

Email of the sender.

Throws

\InvalidArgumentException

If the input sender is an invalid email address.

setSubject

setSubject(string $subject)

Sets the subject for the mail object.

Parameters

Name Description

$subject

string

Subject line.

Throws

\InvalidArgumentException

If subject line is not a string.

setTextBody

setTextBody(string $text) : boolean

Sets plain text for the email body.

Parameters

Name Description

$text

string

Plain text to add.

Throws

\InvalidArgumentException

If text is not a string.

Returns

boolean

True if successful, false otherwise.