Skip to content
A CakePHP 1.3 component used for sending email via the Postmark delivery service
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Postmark CakePHP component

Copyright 2010, Daniel McOrmond Licensed under The MIT License Redistributions of files must retain the above copyright notice.


Written for CakePHP 1.3+


Add the following keys to your configuration:

Configure::write('Postmark.uri', '');
Configure::write('Postmark.key', '810de23c-5ffb-44d9-a424-7a4a5c0fba1a');

If you want your connection to Postmark to be encrypted, simply change the uri to use https.

Make sure to modified the API key to match the credentials for your Postmark server rack instance.


This component extends the base CakePHP email component, and works virtually the same.

Place the postmark.php file in your app/controllers/components/ folder.

In your controller, make sure the component is available:

public $components = array('Postmark');   

Then, simply send messages like this:

$this->Postmark->delivery = 'postmark';
$this->Postmark->from = '<>';
$this->Postmark->to = '<>';
$this->Postmark->subject = 'this is the subject';
$messageBody = 'this is the message body';

You can also use the following optional attributes:

$this->Postmark->cc = '<>';
$this->Postmark->bcc = '<>';
$this->Postmark->replyTo = '<>';

To send to multiple recipients, simply use an array of addresses in the 'to', 'cc', or 'bcc' fields. For example:

$this->Postmark->cc = array('<>', '<>');

The syntax of all parameters is the same as the default CakePHP email component:

There is one additional attribute which can be used for setting the Postmark tag property:

$this->Postmark->tag = 'contact';

For more information, see the Postmark API documentation:


You can see the response from Postmark in the return value when you send a message:

$result = $this->Postmark->send($messageBody);
$this->log($result, 'debug');

If there are any errors, they'll be included in the response. See the Postmark API documentation for error code detail:
You can’t perform that action at this time.