Skip to content
For anybody who wants to use Postmark via API with Swiftmailer, including but not limited to anybody who wants to send mail with Symfony in the normal way that is documented in all of the Symfony HOWTOs etc. Written by Tom Boutell of P'unk Avenue. Swiftmailer core credit
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.


A Symfony-Compatible Swiftmailer backend for Postmark (


Any Swiftmailer fan can use this to deliver email, you don't absolutely need to be using Symfony. You could use it with Symfony 2.0 as well, but here's how we use it with Symfony 1.4.

Configure factories.yml to use Postmark when you use Swiftmailer in a normal fashion, like this:

    delivery_strategy: realtime
      class: sfPostmarkSwiftmailer
        # NOTE: must also be updated in app.yml
        postmarkApiToken: 'GET-YOUR-OWN'
        from: ''
        # postmarkUri could be overridden if necessary

Both the original class and the sfPostmarkSwiftmailer subclass are released under the BSD open source license.


The Postmark mailer assumes that the "main" body of the message (setBody()) is the plaintext version. Just make sure that is the case and use setBody() for the plaintext and addPart() for the HTML (if any):

$message->setBody($text, 'text/plain');
$message->addPart($html, 'text/html');


The Swift_PostmarkTransport class found in the lib/postmark-swiftmailer file is originally by "oystein," as found here:

The original author did not choose to give much information but did select the BSD open source license.

Since that code has not been updated in a long time, there is one modification by P'unk Avenue found here that is not included there. It is a fix for a problem with setting the Postmark "from address" signature:

The subclass sfPostmarkSwiftmailer, found in the main lib/ folder, was written by Tom Boutell of P'unk Avenue ( It adds full Symfony compatibility by implementing dependency injection methods allowing the mailer to be configured via factories.yml. We did this work to help build Apostrophe:


Both the original postmark_swiftmailer code and the sfPostmarkSwiftmailer subclass are released under the BSD license.
You can’t perform that action at this time.