Postmark

Published

Updated

📬

Email delivery service integration.

Postmark delivers transactional e-mail for fortrabbit apps, by API or SMTP. Add its DKIM and Return-Path records at the DNS provider, then send with the Postmark PHP library or the mail settings of the framework.

About Postmark

Postmark sends transactional e-mail, and keeps newsletters in separate broadcast streams, so they do not slow down password resets. Wildbit built it, ActiveCampaign bought it in 2022. fortrabbit sends its own mail with Postmark.

Pricing

Postmark has a free developer plan for testing, see Postmark pricing.

Set up

Add the records at the DNS provider of the domain, as fortrabbit does not host DNS:

  1. DKIM (DomainKeys Identified Mail): A TXT record that verifies the email was sent by a server authorized by the domain owner. Postmark will provide the specific value for this record.
  2. Return-Path (Custom Return-Path): A CNAME record (usually pm-bounces.yourdomain.com) pointing to pm.mtasv.net. This handles bounce processing and aligns the Return-Path domain with your From domain, which is crucial for DMARC alignment.

Verify them in Postmark afterwards.

Using Postmark with fortrabbit

Install the PHP library of Postmark:

composer require wildbit/postmark-php
bash

Example usage

Store the Server Token from Postmark as an ENV var, here POSTMARK_SERVER_TOKEN:

use Postmark\PostmarkClient;

// Create a client with your Server Token
// Best practice: Use an environment variable
$client = new PostmarkClient(getenv('POSTMARK_SERVER_TOKEN'));

// Send an email:
// From, To, Subject, Body
$sendResult = $client->sendEmail(
    "sender@example.com",
    "receiver@example.com",
    "Hello from Postmark!",
    "This is just a friendly 'Hello' from your friends at Postmark."
);

echo "Message ID: " . $sendResult->MessageID;
php

Laravel, Symfony and Craft CMS have Postmark transports, or use the SMTP access of Postmark.

Written by humans and AI in collaboration.

AI use & editorial processEdit on GitHub ↗