API Documentation

\google\appengine\api\mail\Message

FINAL

Allows users to send mail using the App Engine mail APIs.

Methods

send

send()

Send the pre-formed email from the Message object.

Throws

\InvalidArgumentException

If a required field (sender, recipient [to, cc or bcc], subject, body [plain or html]) is missing, or if an ApplicationError was thrown by the RPC call due to an unauthorized sender, an invalid attachment type, or an invalid header name.

\RuntimeException

If an ApplicationError was thrown by the RPC call due to an internal error or bad request.

\google\appengine\runtime\ApplicationError

If there was an unknown error in the RPC call.

__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.

Inherited from

\google\appengine\api\mail\BaseMessage

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).

Inherited from

\google\appengine\api\mail\BaseMessage

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).

Inherited from

\google\appengine\api\mail\BaseMessage

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).

Inherited from

\google\appengine\api\mail\BaseMessage

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).

Inherited from

\google\appengine\api\mail\BaseMessage

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).

Inherited from

\google\appengine\api\mail\BaseMessage

clearAttachments

clearAttachments()

Clear all attachments from the mail object.

Inherited from

\google\appengine\api\mail\BaseMessage

clearHeaders

clearHeaders()

Clear all headers from the mail object.

Inherited from

\google\appengine\api\mail\BaseMessage

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.

Inherited from

\google\appengine\api\mail\BaseMessage

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.

Inherited from

\google\appengine\api\mail\BaseMessage

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.

Inherited from

\google\appengine\api\mail\BaseMessage

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.

Inherited from

\google\appengine\api\mail\BaseMessage

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.

Inherited from

\google\appengine\api\mail\BaseMessage

addBcc

addBcc(mixed $emails)

Adds a "bcc" address, or array of addresses, to the mail object.

Parameters

Name Description

$emails

mixed

String email of individual recipient, or array of emails of recipients.

Throws

\InvalidArgumentException

If any of the input emails are not correctly formatted email addresses.

addCc

addCc(mixed $emails)

Adds a "cc" address, or array of addresses, to the mail object.

Parameters

Name Description

$emails

mixed

String email of individual recipient, or array of emails of recipients.

Throws

\InvalidArgumentException

If any of the input emails are not correctly formatted email addresses.

addTo

addTo(mixed $emails)

Adds a "to" address, or array of addresses, to the mail object.

Parameters

Name Description

$emails

mixed

String email of individual recipient, or array of emails of recipients.

Throws

\InvalidArgumentException

If any of the input emails are not correctly formatted email addresses.

clearBcc

clearBcc()

Clears all "bcc" addresses from the mail object.

clearCc

clearCc()

Clears all "cc" addresses from the mail object.

clearReplyTo

clearReplyTo()

Clear reply-to address from the mail object.

clearTo

clearTo()

Clears all "to" addresses from the mail object.

Send feedback about...

App Engine standard environment for PHP