App Engine PHP SDK  v1 rev.445
The PHP runtime is available as an experimental Preview feature.
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
google\appengine\api\mail\BaseMessage Class Reference
Inheritance diagram for google\appengine\api\mail\BaseMessage:
google\appengine\api\mail\AdminMessage google\appengine\api\mail\Message

Public Member Functions

 send ()
 
 __construct ($options=null)
 
 addAttachment ($filename, $data, $content_id=null)
 
 addAttachmentArray ($attach_array)
 
 addAttachmentsArray ($attach_array)
 
 addHeader ($key, $value)
 
 addHeaderArray ($header_array)
 
 clearAttachments ()
 
 clearHeaders ()
 
 setHtmlBody ($text)
 
 setReplyTo ($email)
 
 setSender ($email)
 
 setSubject ($subject)
 
 setTextBody ($text)
 

Protected Member Functions

 getFunctionArray ()
 
 checkValidAttachment ($filename, &$error)
 
 checkValidEmail ($email)
 
 checkValidHeader ($key, $value, &$error)
 
 handleApplicationError ($e)
 

Protected Attributes

 $message = null
 

Static Protected Attributes

static $allowed_headers
 
static $extension_blacklist
 
static $set_functions
 

Detailed Description

Abstract base class for sending mail using the App Engine mail APIs.

Constructor & Destructor Documentation

google\appengine\api\mail\BaseMessage::__construct (   $options = null)

Construct an instance of Message.

Parameters
array$optionsOptions for message content, key as per set_functions shown above, value to be set.
Exceptions
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.

Member Function Documentation

google\appengine\api\mail\BaseMessage::addAttachment (   $filename,
  $data,
  $content_id = null 
)

Adds an attachment to the Message object.

Parameters
string$filenameFilename of the attachment.
mixed$dataFile data of the attachment.
string$content_idOptional Content-ID header value of the attachment. Must be enclosed by angle brackets (<>).
Exceptions
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).
google\appengine\api\mail\BaseMessage::addAttachmentArray (   $attach_array)

Adds an array of attachments to the Message object.

Parameters
arrayAttachments as filename => data pairs. Example: array("filename.txt" => "This is the file contents.");
Exceptions
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:
google\appengine\api\mail\BaseMessage::addAttachmentsArray (   $attach_array)

Adds an array of attachments to the Message object.

Parameters
arrayArray of arrays that represent attachments. Each attachment array supports name, data, and (optionally) content_id keys. Example: [['name' => 'foo.jpg', 'data' => 'data', 'content_id' => '<foo>']]
Exceptions
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).
google\appengine\api\mail\BaseMessage::addHeader (   $key,
  $value 
)

Adds a header pair to the mail object.

Parameters
string$keyHeader name (from the whitelist) to be added.
string$valueHeader value to be added.
Exceptions
InvalidArgumentException If the header is not on the whitelist, or if the header is invalid (i.e. not a string).
google\appengine\api\mail\BaseMessage::addHeaderArray (   $header_array)

Adds an array of headers to the mail object.

Parameters
arrayAn array of headers.
Exceptions
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).
google\appengine\api\mail\BaseMessage::checkValidAttachment (   $filename,
$error 
)
protected

Checks that an attachment is valid.

Parameters
string$filenameFilename of the attachment.
Returns
bool True if successful, false otherwise.
Parameters
string&$errorError message to be set if the header is invalid.
google\appengine\api\mail\BaseMessage::checkValidEmail (   $email)
protected

Checks that an email is valid.

Parameters
string$emailThe email to be validated.
Returns
bool True if valid, false otherwise.
google\appengine\api\mail\BaseMessage::checkValidHeader (   $key,
  $value,
$error 
)
protected

Check validity of a header pair.

Parameters
string$keyHeader key.
string$valueHeader value.
string&$errorError message to be set if the header is invalid.
Returns
bool True if successful, false otherwise.
google\appengine\api\mail\BaseMessage::clearAttachments ( )

Clear all attachments from the mail object.

google\appengine\api\mail\BaseMessage::clearHeaders ( )

Clear all headers from the mail object.

google\appengine\api\mail\BaseMessage::handleApplicationError (   $e)
protected

Handles application errors generated by the RPC call.

Parameters
ApplicationErrorAn exception caught during the RPC call.
Exceptions
RuntimeException If there was an internal error or bad request.
InvalidArgumentException If there was an unauthorized sender, an invalid attachment type, or an invalid header name.
ApplicationErrorIf the error is not one of the above.
google\appengine\api\mail\BaseMessage::setHtmlBody (   $text)

Sets HTML content for the email body.

Parameters
string$textHTML to add.
Exceptions
InvalidArgumentException If text is not a string.
google\appengine\api\mail\BaseMessage::setReplyTo (   $email)

Sets a reply-to address for the mail object.

Parameters
string$emailReply-to address.
Exceptions
InvalidArgumentException If the input reply-to address is an invalid email address.
google\appengine\api\mail\BaseMessage::setSender (   $email)

Sets the sender for the mail object.

Parameters
string$emailEmail of the sender.
Exceptions
InvalidArgumentException If the input sender is an invalid email address.
google\appengine\api\mail\BaseMessage::setSubject (   $subject)

Sets the subject for the mail object.

Parameters
string$subjectSubject line.
Exceptions
InvalidArgumentException If subject line is not a string.
google\appengine\api\mail\BaseMessage::setTextBody (   $text)

Sets plain text for the email body.

Parameters
string$textPlain text to add.
Returns
bool True if successful, false otherwise.
Exceptions
InvalidArgumentException If text is not a string.

Member Data Documentation

google\appengine\api\mail\BaseMessage::$allowed_headers
staticprotected
Initial value:
= array(
'auto-submitted', 'in-reply-to', 'list-id', 'list-unsubscribe',
'on-behalf-of', 'references', 'resent-date', 'resent-from', 'resent-to')
google\appengine\api\mail\BaseMessage::$extension_blacklist
staticprotected
Initial value:
= array(
'ade', 'adp', 'bat', 'chm', 'cmd', 'com', 'cpl', 'exe', 'hta', 'ins',
'isp', 'jse', 'lib', 'mde', 'msc', 'msp', 'mst', 'pif', 'scr', 'sct',
'shb', 'sys', 'vb', 'vbe', 'vbs', 'vxd', 'wsc', 'wsf', 'wsh')
google\appengine\api\mail\BaseMessage::$set_functions
staticprotected
Initial value:
= array('sender' => 'setSender',
'replyto' => 'setReplyTo',
'to' => 'addTo',
'cc' => 'addCc',
'bcc' => 'addBcc',
'subject' => 'setSubject',
'textBody' => 'setTextBody',
'htmlBody' => 'setHtmlBody',
'header' => 'addHeaderArray',
'attachment' => 'addAttachmentArray',
'attachments' => 'addAttachmentsArray')

The documentation for this class was generated from the following file: