FINAL
Allows users to send mail to application admins using the App Engine mail APIs.
Methods
send
send()
Send the pre-formed email from the Message object to application admins.
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 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 of the attachment. |
|
File data of the attachment. |
|
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 |
---|---|
|
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 |
---|---|
|
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 |
---|---|
|
Header name (from the whitelist) to be added. |
|
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 |
---|---|
|
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 |
---|---|
|
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 |
---|---|
|
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 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 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 |
---|---|
|
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