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 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 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).
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).
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).
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).
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).
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 |
---|---|
|
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 |
---|---|
|
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 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 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 |
---|---|
|
Plain text to add. |
Throws
\InvalidArgumentException
If text is not a string.
Returns
boolean
True if successful, false otherwise.