google/appengine/api/mail/BaseMessage.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\BaseMessage
Methods
__construct
(array $options = null)
: void
Construct an instance of Message.
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.
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.
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). |
- Deprecated
addAttachmentsArray
(array $attach_array)
: void
Adds an array of attachments to the Message object.
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). |
addHeader
(string $key, string $value)
: void
Adds a header pair to the mail object.
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.
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). |
setHtmlBody
(string $text)
: void
Sets HTML content for the email body.
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.
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.
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.
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.
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. |