google/appengine/api/mail/Message.php
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
\google\appengine\api\mail\Message
- Parent(s)
- \google\appengine\api\mail\BaseMessage
Methods
__construct
(array $options = null)
: void
Construct an instance of Message.
Inherited from: \google\appengine\api\mail\BaseMessage::__construct()Name | Type | Description |
---|---|---|
$options | array |
Options for message content, key as per set_functions shown above, value to be set. |
Exception | Description |
---|---|
\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
(string $filename, mixed $data, string $content_id = null)
: void
Adds an attachment to the Message object.
Inherited from: \google\appengine\api\mail\BaseMessage::addAttachment()Name | Type | 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 (<>). |
Exception | Description |
---|---|
\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
(array $attach_array)
: void
Adds an array of attachments to the Message object.
Inherited from: \google\appengine\api\mail\BaseMessage::addAttachmentArray()Name | Type | Description |
---|---|---|
$attach_array | array |
Attachments as filename => data pairs. Example: array("filename.txt" => "This is the file contents."); |
Exception | Description |
---|---|
\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
(array $attach_array)
: void
Adds an array of attachments to the Message object.
Inherited from: \google\appengine\api\mail\BaseMessage::addAttachmentsArray()Name | Type | Description |
---|---|---|
$attach_array | array |
Array of arrays that represent attachments. Each attachment
array supports name, data, and (optionally) content_id keys. Example:
[['name' => 'foo.jpg', 'data' => 'data', 'content_id' => '
|
Exception | Description |
---|---|
\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). |
addBcc
(mixed $emails)
: void
Adds a "bcc" address, or array of addresses, to the mail object.
Name | Type | Description |
---|---|---|
$emails | mixed |
String email of individual recipient, or array of emails of recipients. |
Exception | Description |
---|---|
\InvalidArgumentException | If any of the input emails are not correctly formatted email addresses. |
addCc
(mixed $emails)
: void
Adds a "cc" address, or array of addresses, to the mail object.
Name | Type | Description |
---|---|---|
$emails | mixed |
String email of individual recipient, or array of emails of recipients. |
Exception | Description |
---|---|
\InvalidArgumentException | If any of the input emails are not correctly formatted email addresses. |
addHeader
(string $key, string $value)
: void
Adds a header pair to the mail object.
Inherited from: \google\appengine\api\mail\BaseMessage::addHeader()Name | Type | Description |
---|---|---|
$key | string |
Header name (from the whitelist) to be added. |
$value | string |
Header value to be added. |
Exception | Description |
---|---|
\InvalidArgumentException | If the header is not on the whitelist, or if the header is invalid (i.e. not a string). |
addHeaderArray
(array $header_array)
: void
Adds an array of headers to the mail object.
Inherited from: \google\appengine\api\mail\BaseMessage::addHeaderArray()Name | Type | Description |
---|---|---|
$header_array | array |
An array of headers. |
Exception | Description |
---|---|
\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). |
addTo
(mixed $emails)
: void
Adds a "to" address, or array of addresses, to the mail object.
Name | Type | Description |
---|---|---|
$emails | mixed |
String email of individual recipient, or array of emails of recipients. |
Exception | Description |
---|---|
\InvalidArgumentException | If any of the input emails are not correctly formatted email addresses. |
clearAttachments
()
: void
Clear all attachments from the mail object.
Inherited from: \google\appengine\api\mail\BaseMessage::clearAttachments()
clearHeaders
()
: void
Clear all headers from the mail object.
Inherited from: \google\appengine\api\mail\BaseMessage::clearHeaders()
send
()
: void
Send the pre-formed email from the Message object.
Exception | Description |
---|---|
\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. |
setHtmlBody
(string $text)
: void
Sets HTML content for the email body.
Inherited from: \google\appengine\api\mail\BaseMessage::setHtmlBody()Name | Type | Description |
---|---|---|
$text | string |
HTML to add. |
Exception | Description |
---|---|
\InvalidArgumentException | If text is not a string. |
setReplyTo
(string $email)
: void
Sets a reply-to address for the mail object.
Inherited from: \google\appengine\api\mail\BaseMessage::setReplyTo()Name | Type | Description |
---|---|---|
string |
Reply-to address. |
Exception | Description |
---|---|
\InvalidArgumentException | If the input reply-to address is an invalid email address. |
setSender
(string $email)
: void
Sets the sender for the mail object.
Inherited from: \google\appengine\api\mail\BaseMessage::setSender()Name | Type | Description |
---|---|---|
string |
Email of the sender. |
Exception | Description |
---|---|
\InvalidArgumentException | If the input sender is an invalid email address. |
setSubject
(string $subject)
: void
Sets the subject for the mail object.
Inherited from: \google\appengine\api\mail\BaseMessage::setSubject()Name | Type | Description |
---|---|---|
$subject | string |
Subject line. |
Exception | Description |
---|---|
\InvalidArgumentException | If subject line is not a string. |
setTextBody
(string $text)
: bool
Sets plain text for the email body.
Inherited from: \google\appengine\api\mail\BaseMessage::setTextBody()Name | Type | Description |
---|---|---|
$text | string |
Plain text to add. |
Type | Description |
---|---|
bool | True if successful, false otherwise. |
Exception | Description |
---|---|
\InvalidArgumentException | If text is not a string. |