Campustream 1.0
A social network MQP for WPI
Mail_Postmark Class Reference

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')

Detailed Description

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.

Author:
Markus Hedlund (markus@mimmin.com) at mimmin (www.mimmin.com) Copyright 2009 - 2010, Markus Hedlund, Mimmin AB, www.mimmin.com
Version:
0.4.3 http://www.opensource.org/licenses/mit-license.php The MIT License

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.


Constructor & Destructor Documentation

__construct ( )

Initialize

Definition at line 60 of file Postmark.php.


Member Function Documentation

_addRecipient ( type,
address,
name = null 
)
Parameters:
string$typeEither 'to', 'cc' or 'bcc'
string$address
string | null$name
Exceptions:
InvalidArgumentExceptionOn invalid address
OverflowExceptionIf 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:

  • filenameAlias, use a different filename for the attachment
Parameters:
string$filenameLocation of the file
array$optionsAn optional array with options
Exceptions:
InvalidArgumentExceptionIf file doesn't exist
OverflowExceptionIf maximum attachment size has been reached
Returns:
Mail_Postmark

Definition at line 104 of file Postmark.php.

& addBcc ( address,
name = null 
)

Add a BCC address

Parameters:
string$addressE-mail address used in BCC
string$nameOptional. Name used in BCC
Exceptions:
InvalidArgumentExceptionOn invalid address
OverflowExceptionIf there are too many email recipients
Returns:
Mail_Postmark

Definition at line 128 of file Postmark.php.

& addCc ( address,
name = null 
)

Add a CC address

Parameters:
string$addressE-mail address used in CC
string$nameOptional. Name used in CC
Exceptions:
InvalidArgumentExceptionOn invalid address
OverflowExceptionIf there are too many email recipients
Returns:
Mail_Postmark

Definition at line 143 of file Postmark.php.

& addCustomAttachment ( filename,
content,
mimeType 
)

Add an attachment.

Parameters:
string$filenameWhat to call the file
string$contentRaw file data
string$mimeTypeThe mime type of the file
Exceptions:
OverflowExceptionIf maximum attachment size has been reached
Returns:
Mail_Postmark

Definition at line 158 of file Postmark.php.

& addHeader ( name,
value 
)

Add a custom header

Parameters:
string$nameCustom header name
string$valueCustom header value
Returns:
Mail_Postmark

Definition at line 187 of file Postmark.php.

& addTo ( address,
name = null 
)

Add a receiver

Parameters:
string$addressE-mail address used in To
string$nameOptional. Name used in To
Exceptions:
InvalidArgumentExceptionOn invalid address
OverflowExceptionIf there are too many email recipients
Returns:
Mail_Postmark

Definition at line 202 of file Postmark.php.

static compose ( ) [static]

New e-mail

Returns:
Mail_Postmark

Definition at line 213 of file Postmark.php.

& debug ( mode = self::DEBUG_VERBOSE)

Turns debug output on

Parameters:
int$modeOne of the debug constants
Returns:
Mail_Postmark

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

Parameters:
string$addressE-mail address used in From
string$nameOptional. Name used in From
Exceptions:
InvalidArgumentExceptionOn invalid address
Returns:
Mail_Postmark

Definition at line 239 of file Postmark.php.

& fromName ( name)

Specify sender name. Overwrites default From name, but doesn't change address.

Parameters:
string$nameName used in From
Returns:
Mail_Postmark

Definition at line 255 of file Postmark.php.

& messageHtml ( message)

Add HTML message. Can be used in conjunction with messagePlain()

Parameters:
string$messageE-mail message
Returns:
Mail_Postmark

Definition at line 267 of file Postmark.php.

& messagePlain ( message)

Add plaintext message. Can be used in conjunction with messageHtml()

Parameters:
string$messageE-mail message
Returns:
Mail_Postmark

Definition at line 278 of file Postmark.php.

& replyTo ( address,
name = null 
)

Specify reply-to

Parameters:
string$addressE-mail address used in To
string$nameOptional. Name used in To
Exceptions:
InvalidArgumentExceptionOn invalid address
Returns:
Mail_Postmark

Definition at line 292 of file Postmark.php.

send ( )

Sends the e-mail. Prints debug output if debug mode is turned on

Exceptions:
ExceptionIf HTTP code 422, Exception with API error code and Postmark message, otherwise HTTP code.
BadMethodCallExceptionIf From address, To address or Subject is missing
Returns:
boolean|array True if success, array if DEBUG_RETURN is enabled

Definition at line 309 of file Postmark.php.

& subject ( subject)

Specify subject

Parameters:
string$subjectE-mail subject
Returns:
Mail_Postmark

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.

Parameters:
string$tagOne tag
Returns:
Mail_Postmark

Definition at line 396 of file Postmark.php.

& to ( address,
name = null 
)

Specify receiver. Use addTo to add more.

Deprecated:
Use addTo.
Parameters:
string$addressE-mail address used in To
string$nameOptional. Name used in To
Returns:
Mail_Postmark

Definition at line 410 of file Postmark.php.


Field Documentation

$_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.


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