Sending
Custom Headers
Custom headers attach metadata to emails for internal tracking, routing, and compliance requirements.
Adding Custom Headers
curl -X POST https://api.postmta.com/v1/messages/send -H "Authorization: Bearer pmta_live_xxxx" -d '{"from":{"address":"hello@shop.example.com"},"to":[{"address":"alice@example.com"}],"subject":"Your order shipped","html":"...","headers":{"X-Customer-ID":"cust_abc123","X-Order-ID":"order_789","X-Campaign-Code":"summer_sale_2026"}}'Reserved Headers
These headers are set by PostMTA and cannot be overridden:
| Header | Description |
|---|---|
X-PostMTA-Message-ID | PostMTA unique message identifier |
X-PostMTA-Timestamp | UTC timestamp of queue acceptance |
Return-Path | Bounce address (envelope MAIL FROM) |
DKIM-Signature | DomainKeys Identified Mail signature |
Authentication-Results | SPF, DKIM, DMARC authentication results |
Tracking Headers
PostMTA automatically adds tracking headers. Disable per-message:
{"headers":{"X-PostMTA-Track-Opens":"no","X-PostMTA-Track-Clicks":"no"}}Header Limits
- Maximum 50 custom headers per message
- Maximum header value length: 16 KB
- Header names must be 7-bit ASCII