\Mail_Postmark
Postmark PHP class
Copyright 2011, 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: Copyright 2009 - 2011, Markus Hedlund, Mimmin AB, www.mimmin.com
- License: http://www.opensource.org/licenses/mit-license.php The MIT License
Synopsis
class Mail_Postmark
{
- // constants
- const DEBUG_OFF = 0;
- const DEBUG_VERBOSE = 1;
- const DEBUG_RETURN = 2;
- const TESTING_API_KEY = 'POSTMARK_API_TEST';
- const MAX_ATTACHMENT_SIZE = 10485760;
- const RECIPIENT_TYPE_TO = 'to';
- const RECIPIENT_TYPE_CC = 'cc';
- const RECIPIENT_TYPE_BCC = 'bcc';
- // members
- public static array $_mimeTypes = ;
- private $_apiKey;
- private $_from;
- private array $_to = ;
- private array $_cc = ;
- private array $_bcc = ;
- private $_replyTo;
- private $_subject;
- private $_tag;
- private $_messagePlain;
- private $_messageHtml;
- private array $_headers = ;
- private array $_attachments = ;
- private $_debugMode = self::DEBUG_OFF;
- // methods
- public void __construct()
- public Mail_Postmark addAttachment()
- public Mail_Postmark addBcc()
- public Mail_Postmark addCc()
- public Mail_Postmark addCustomAttachment()
- public Mail_Postmark addHeader()
- public Mail_Postmark addTo()
- public static Mail_Postmark compose()
- public Mail_Postmark debug()
- public Mail_Postmark from()
- public Mail_Postmark fromName()
- public Mail_Postmark messageHtml()
- public Mail_Postmark messagePlain()
- public Mail_Postmark replyTo()
- public boolean send()
- public Mail_Postmark subject()
- public Mail_Postmark tag()
- public Mail_Postmark to()
- public void _addRecipient()
- private void _createAddress()
- private string _getMimeType()
- private bool _isTwoHundred()
- private void _log()
- private array _prepareData()
- private bool _validateAddress()
- private void _validateData()
Constants
Name | Value |
---|---|
DEBUG_OFF | 0 |
DEBUG_VERBOSE | 1 |
DEBUG_RETURN | 2 |
TESTING_API_KEY | 'POSTMARK_API_TEST' |
MAX_ATTACHMENT_SIZE | 10485760 |
RECIPIENT_TYPE_TO | 'to' |
RECIPIENT_TYPE_CC | 'cc' |
RECIPIENT_TYPE_BCC | 'bcc' |
Members
private
- $_apiKey
- $_attachments
- $_bcc
- $_cc
- $_debugMode
- $_from
- $_headers
- $_messageHtml
- $_messagePlain
- $_replyTo
- $_subject
- $_tag
- $_to
public
- $_mimeTypes
Methods
private
- _createAddress()
- _getMimeType() — Try to detect the mime type
- _isTwoHundred() — If a number is 200-299
- _log() — Call the logger method, if one exists
- _prepareData() — Prepares the data array
- _validateAddress() — Validates an e-mail address
- _validateData() — Validate that the email can be sent
public
- __construct() — Initialize
- _addRecipient()
- addAttachment() — Add a physical file as an attachment Options: - filenameAlias, use a different filename for the attachment
- addBcc() — Add a BCC address
- addCc() — Add a CC address
- addCustomAttachment() — Add an attachment.
- addHeader() — Add a custom header
- addTo() — Add a receiver
- compose() — New e-mail
- debug() — Turns debug output on
- from() — Specify sender. Overwrites default From. Note that the address must first be added in the Postmark app admin interface
- fromName() — Specify sender name. Overwrites default From name, but doesn't change address.
- messageHtml() — Add HTML message. Can be used in conjunction with messagePlain()
- messagePlain() — Add plaintext message. Can be used in conjunction with messageHtml()
- replyTo() — Specify reply-to
- send() — Sends the e-mail. Prints debug output if debug mode is turned on
- subject() — Specify subject
- tag() — You can categorize outgoing email using the optional Tag property.
- to() — Specify receiver. Use addTo to add more.