Postmark Email Provider
Transactional email delivery for emdash via the Postmark API.
What it does
This plugin registers an email:deliver exclusive hook in emdash's email pipeline. When any plugin calls ctx.email.send() (like the forms plugin sending notification emails), the message is delivered through Postmark's API.
Without an email provider plugin, emdash has no production email delivery. The built-in console provider only works in dev mode. This plugin fills that gap for Cloudflare Workers deployments.
Setup
Copy the plugin source into your emdash site directory (it needs to import definePlugin from emdash):
sites/your-site/plugins/postmark-email.ts Register it in astro.config.mjs:
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
// In the emdash() plugins array:
{
id: "postmark-email",
version: "0.1.0",
entrypoint: resolve(__dirname, "plugins/postmark-email.ts"),
options: {
serverToken: env.POSTMARK_SERVER_TOKEN,
fromAddress: env.POSTMARK_FROM_ADDRESS,
},
capabilities: ["email:provide", "network:fetch"],
allowedHosts: ["api.postmarkapp.com"],
} Configuration
Add a .env file (gitignored) with your Postmark credentials:
POSTMARK_SERVER_TOKEN=your-server-api-token
POSTMARK_FROM_ADDRESS=noreply@yourdomain.com The from address must be a verified sender signature in Postmark.
Known issue: post-build patch required
emdash has a bug (emdash-cms/emdash#215) where plugin route handlers don't receive ctx.email. A post-build patch is required. See the README for details.
Requirements
- Cloudflare Workers Paid plan ($5/month). The free plan's CPU limit is too short for emdash's email pipeline to initialize.
- A Postmark account with a verified sender signature.
- emdash v0.1.0+