Send email from DaloyJS with Postmark
Postmark is a transactional-first email provider known for very high inbox placement and detailed delivery analytics. This guide uses the official postmark SDK.
- 01requestRoute handlerServerClientclient.sendEmail({ From, To, Subject, MessageStream })MessageStream defaults to outbound
- 02requestServerClientPostmark APIPOST /emailheader X-Postmark-Server-Token
- 03responsePostmark APIRoute handler{ ErrorCode, MessageID }throw unless ErrorCode === 0, else return { id: MessageID }
- 04asyncPostmark APIWebhooksdelivery, bounce, spam-complaint eventsverify the request before trusting payloads
1. Provision
- Create a Postmark server under Servers → New server, then open it and copy the Server API Token from API Tokens.
- Add a Sender Signature (single address) or, for production, configure a full Sender Domain with DKIM and Return-Path records.
- Decide which Message Stream you'll use:
outbound: default transactional streambroadcast: bulk/marketing (must be enabled on the server)
2. Install
3. Environment variables
4. Plugin
5. Use it in a route
Server-side templates
Create a template in Templates (Mustachio syntax), then send it by TemplateAlias:
Batch sending
Use client.sendEmailBatch([...]) or client.sendEmailBatchWithTemplates([...]) to send up to 500 messages per request, the response is an array with one result per message so you can inspect per-recipient errors.
Runtimes
The postmark SDK currently uses axios under the hood, so it targets Node and Node-compatible runtimes (Bun, Deno's Node-compat, AWS Lambda). For Cloudflare Workers or Vercel, call the REST endpoint directly with fetch:POST https://api.postmarkapp.com/email with the header X-Postmark-Server-Token.
See also Resend, Mailgun, and the email integrations overview.