Campustream 1.0
A social network MQP for WPI
|
Public Member Functions | |
__construct () | |
& | addAttachment ($filename, $options=array()) |
& | addBcc ($address, $name=null) |
& | addCc ($address, $name=null) |
& | addCustomAttachment ($filename, $content, $mimeType) |
& | addHeader ($name, $value) |
& | addTo ($address, $name=null) |
& | debug ($mode=self::DEBUG_VERBOSE) |
& | from ($address, $name=null) |
& | fromName ($name) |
& | messageHtml ($message) |
& | messagePlain ($message) |
& | replyTo ($address, $name=null) |
send () | |
& | subject ($subject) |
& | tag ($tag) |
& | to ($address, $name=null) |
_addRecipient ($type, $address, $name=null) | |
Static Public Member Functions | |
static | compose () |
Data Fields | |
const | DEBUG_OFF = 0 |
const | DEBUG_VERBOSE = 1 |
const | DEBUG_RETURN = 2 |
const | TESTING_API_KEY = 'POSTMARK_API_TEST' |
const | MAX_ATTACHMENT_SIZE = 10485760 |
Static Public Attributes | |
static | $_mimeTypes = array('ai' => 'application/postscript', 'avi' => 'video/x-msvideo', 'doc' => 'application/msword', 'eps' => 'application/postscript', 'gif' => 'image/gif', 'htm' => 'text/html', 'html' => 'text/html', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'mov' => 'video/quicktime', 'mp3' => 'audio/mpeg', 'mpg' => 'video/mpeg', 'pdf' => 'application/pdf', 'ppt' => 'application/vnd.ms-powerpoint', 'ps' => 'application/postscript', 'rtf' => 'application/rtf', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'txt' => 'text/plain', 'xls' => 'application/vnd.ms-excel', 'csv' => 'text/comma-separated-values', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'flv' => 'video/x-flv', 'ics' => 'text/calendar', 'log' => 'text/plain', 'png' => 'image/png', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'psd' => 'image/photoshop', 'rm' => 'application/vnd.rn-realmedia', 'swf' => 'application/x-shockwave-flash', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xml' => 'text/xml') |
Postmark PHP class
Copyright 2010, Markus Hedlund, Mimmin AB, www.mimmin.com Licensed under The MIT License Redistributions of files must retain the above copyright notice.
Usage: Mail_Postmark::compose() ->addTo('address.com', 'Name') ->subject('Subject') ->messagePlain('Plaintext message') ->tag('Test tag') ->send();
or:
$email = new Mail_Postmark(); $email->addTo('address.com', 'Name') ->subject('Subject') ->messagePlain('Plaintext message') ->tag('Test tag') ->send();
Definition at line 33 of file Postmark.php.
__construct | ( | ) |
Initialize
Definition at line 60 of file Postmark.php.
_addRecipient | ( | $ | type, |
$ | address, | ||
$ | name = null |
||
) |
string | $type | Either 'to', 'cc' or 'bcc' |
string | $address | |
string | null | $name |
InvalidArgumentException | On invalid address |
OverflowException | If there are too many email recipients |
Definition at line 424 of file Postmark.php.
& addAttachment | ( | $ | filename, |
$ | options = array() |
||
) |
Add a physical file as an attachment Options:
string | $filename | Location of the file |
array | $options | An optional array with options |
InvalidArgumentException | If file doesn't exist |
OverflowException | If maximum attachment size has been reached |
Definition at line 104 of file Postmark.php.
& addBcc | ( | $ | address, |
$ | name = null |
||
) |
Add a BCC address
string | $address | E-mail address used in BCC |
string | $name | Optional. Name used in BCC |
InvalidArgumentException | On invalid address |
OverflowException | If there are too many email recipients |
Definition at line 128 of file Postmark.php.
& addCc | ( | $ | address, |
$ | name = null |
||
) |
Add a CC address
string | $address | E-mail address used in CC |
string | $name | Optional. Name used in CC |
InvalidArgumentException | On invalid address |
OverflowException | If there are too many email recipients |
Definition at line 143 of file Postmark.php.
& addCustomAttachment | ( | $ | filename, |
$ | content, | ||
$ | mimeType | ||
) |
Add an attachment.
string | $filename | What to call the file |
string | $content | Raw file data |
string | $mimeType | The mime type of the file |
OverflowException | If maximum attachment size has been reached |
Definition at line 158 of file Postmark.php.
& addHeader | ( | $ | name, |
$ | value | ||
) |
Add a custom header
string | $name | Custom header name |
string | $value | Custom header value |
Definition at line 187 of file Postmark.php.
& addTo | ( | $ | address, |
$ | name = null |
||
) |
Add a receiver
string | $address | E-mail address used in To |
string | $name | Optional. Name used in To |
InvalidArgumentException | On invalid address |
OverflowException | If there are too many email recipients |
Definition at line 202 of file Postmark.php.
static compose | ( | ) | [static] |
& debug | ( | $ | mode = self::DEBUG_VERBOSE | ) |
Turns debug output on
int | $mode | One of the debug constants |
Definition at line 224 of file Postmark.php.
& from | ( | $ | address, |
$ | name = null |
||
) |
Specify sender. Overwrites default From. Note that the address must first be added in the Postmarkapp admin interface
string | $address | E-mail address used in From |
string | $name | Optional. Name used in From |
InvalidArgumentException | On invalid address |
Definition at line 239 of file Postmark.php.
& fromName | ( | $ | name | ) |
Specify sender name. Overwrites default From name, but doesn't change address.
string | $name | Name used in From |
Definition at line 255 of file Postmark.php.
& messageHtml | ( | $ | message | ) |
Add HTML message. Can be used in conjunction with messagePlain()
string | $message | E-mail message |
Definition at line 267 of file Postmark.php.
& messagePlain | ( | $ | message | ) |
Add plaintext message. Can be used in conjunction with messageHtml()
string | $message | E-mail message |
Definition at line 278 of file Postmark.php.
& replyTo | ( | $ | address, |
$ | name = null |
||
) |
Specify reply-to
string | $address | E-mail address used in To |
string | $name | Optional. Name used in To |
InvalidArgumentException | On invalid address |
Definition at line 292 of file Postmark.php.
send | ( | ) |
Sends the e-mail. Prints debug output if debug mode is turned on
Exception | If HTTP code 422, Exception with API error code and Postmark message, otherwise HTTP code. |
BadMethodCallException | If From address, To address or Subject is missing |
Definition at line 309 of file Postmark.php.
& subject | ( | $ | subject | ) |
Specify subject
string | $subject | E-mail subject |
Definition at line 380 of file Postmark.php.
& tag | ( | $ | tag | ) |
You can categorize outgoing email using the optional Tag property. If you use different tags for the different types of emails your application generates, you will be able to get detailed statistics for them through the Postmark user interface. Only 1 tag per email is supported.
string | $tag | One tag |
Definition at line 396 of file Postmark.php.
& to | ( | $ | address, |
$ | name = null |
||
) |
Specify receiver. Use addTo to add more.
string | $address | E-mail address used in To |
string | $name | Optional. Name used in To |
Definition at line 410 of file Postmark.php.
$_mimeTypes = array('ai' => 'application/postscript', 'avi' => 'video/x-msvideo', 'doc' => 'application/msword', 'eps' => 'application/postscript', 'gif' => 'image/gif', 'htm' => 'text/html', 'html' => 'text/html', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'mov' => 'video/quicktime', 'mp3' => 'audio/mpeg', 'mpg' => 'video/mpeg', 'pdf' => 'application/pdf', 'ppt' => 'application/vnd.ms-powerpoint', 'ps' => 'application/postscript', 'rtf' => 'application/rtf', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'txt' => 'text/plain', 'xls' => 'application/vnd.ms-excel', 'csv' => 'text/comma-separated-values', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'flv' => 'video/x-flv', 'ics' => 'text/calendar', 'log' => 'text/plain', 'png' => 'image/png', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'psd' => 'image/photoshop', 'rm' => 'application/vnd.rn-realmedia', 'swf' => 'application/x-shockwave-flash', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xml' => 'text/xml') [static] |
Definition at line 41 of file Postmark.php.
const DEBUG_OFF = 0 |
Definition at line 35 of file Postmark.php.
const DEBUG_RETURN = 2 |
Definition at line 37 of file Postmark.php.
const DEBUG_VERBOSE = 1 |
Definition at line 36 of file Postmark.php.
const MAX_ATTACHMENT_SIZE = 10485760 |
Definition at line 39 of file Postmark.php.
const TESTING_API_KEY = 'POSTMARK_API_TEST' |
Definition at line 38 of file Postmark.php.