Source: https://docs.postilio.eu/quickstart.md # Quickstart Your first email through Postilio, from a domain of your own. You need a Postilio organization and access to the DNS of the domain you send from. The DNS step is the slow one; the rest takes a few minutes. ## 1. Add your sending domain In the portal, open **Domains** and add the domain you send from, for example `mail.example.com`. Postilio shows three CNAME records; create them at your DNS provider: | Name | Type | Value | |---|---|---| | `pst1._domainkey.mail.example.com` | CNAME | `pst1..dkim.pstlmta.net` | | `pst2._domainkey.mail.example.com` | CNAME | `pst2..dkim.pstlmta.net` | | `pst-bounces.mail.example.com` | CNAME | `rp.pstlmta.net` | Copy the exact values from the portal: the token is your domain's own. Postilio checks the records every 10 minutes, or right away when you press **Check now**. Once they are found the domain is `verified`, and you can send from any address on it. [Sending domains](domains.md) explains the records. ## 2. Create an API key Open **Keys & SMTP** and create a key. Start with a **test** key (`pk_test_…`): its messages are checked like a live key's (sender domain, restrictions, suppression list) but never sent, so you can try everything below safely. The key is shown once; store it as an environment variable: ```sh export POSTILIO_KEY=pk_test_... ``` ## 3. Send an email Send to the simulator: with a test key, `delivered@simulator.postilio.eu` gets a simulated delivery. Use an address on your own verified domain as the sender. ```sh curl https://api.postilio.eu/v1/emails \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "Acme ", "to": ["delivered@simulator.postilio.eu"], "subject": "Welcome to Acme", "text": "Hi Ada, your account is ready.", "tag": "welcome" }' ``` Postilio answers `202 Accepted` with one message id per recipient: ```json { "ids": ["01a10ce5-a09a-788b-9243-d7c9c59773d2"], "suppressed": [] } ``` The same in Node: ```js // Sends an email with the Postilio API: node send.mjs (Node 18 or later, no packages needed). const response = await fetch('https://api.postilio.eu/v1/emails', { method: 'POST', headers: { Authorization: `Bearer ${process.env.POSTILIO_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ from: 'Acme ', to: ['delivered@simulator.postilio.eu'], subject: 'Welcome to Acme', text: 'Hi Ada, your account is ready.', tag: 'welcome', }), }); const result = await response.json(); if (!response.ok) { throw new Error(`Postilio answered ${response.status}: ${JSON.stringify(result)}`); } console.log(result.ids[0]); // one id per recipient, in the order of "to" ``` And in C#: ```csharp // Sends an email with the Postilio API: dotnet run Send.cs (.NET 10, no packages needed). // A file-based app is compiled ahead of time, without reflection-based JSON; in a project, leave this line out. #:property PublishAot=false using System.Net.Http.Headers; using System.Net.Http.Json; using var http = new HttpClient { BaseAddress = new Uri("https://api.postilio.eu/") }; http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("POSTILIO_KEY")); var response = await http.PostAsJsonAsync("v1/emails", new { from = "Acme ", to = new[] { "delivered@simulator.postilio.eu" }, subject = "Welcome to Acme", text = "Hi Ada, your account is ready.", tag = "welcome", }); if (!response.IsSuccessStatusCode) { throw new HttpRequestException($"Postilio answered {(int)response.StatusCode}: {await response.Content.ReadAsStringAsync()}"); } var result = await response.Content.ReadFromJsonAsync(); Console.WriteLine(result?.Ids[0]); // one id per recipient, in the order of "to" record SendEmailResponse(Guid[] Ids, string[] Suppressed); ``` ## 4. Follow what happened Look the message up by its id, or open **Messages** in the portal: ```sh curl https://api.postilio.eu/v1/emails/$EMAIL_ID \ -H "Authorization: Bearer $POSTILIO_KEY" ``` The answer has the message's `status` and every event, from `accepted` to `delivered`. Rather than asking, you can let Postilio tell you: see [Webhooks](webhooks.md). ## 5. Go live Create a **live** key (`pk_live_…`) and send to a real address. A new organization starts in the **sandbox**: live mail goes only to your team and to addresses on your verified domains, at most 100 recipients a day and 10 a minute. The **Sandbox** page in the portal shows how far you are and how to ask for full access. Full access starts with four weeks of [probation](errors.md#probation-after-the-sandbox), a daily cap that rises each week. [Errors and limits](errors.md#the-sandbox) has the details. Next: [Sending email](sending.md) for everything a message can hold, and over SMTP; [Authentication and API keys](authentication.md) for scopes and restrictions. Source: https://docs.postilio.eu/authentication.md # Authentication and API keys Every request to the API carries an API key as a bearer token: ```sh curl https://api.postilio.eu/v1/domains \ -H "Authorization: Bearer $POSTILIO_KEY" ``` SMTP uses the same keys: user name `apikey`, the key as the password (see [Sending email](sending.md#smtp)). ## Keys A key belongs to one **project** and works only on that project's domains, messages, suppressions and webhooks. Create keys in the portal under **Keys & SMTP**: Owners and Admins of the organization in every project, Developers in the projects they have access to. - A key is `pk_live_` or `pk_test_` followed by 32 letters and digits. - **It is shown once.** Postilio stores only a hash of it; the portal shows the first characters, so you can tell keys apart. Lost a key? Revoke it and create a new one. - **Revoking** takes effect at once. An SMTP connection that logged in with the key before gets its next message refused. - **Changing** a key's name, scopes and restrictions is done in the portal too (Owners, Admins and Developers with access to the project). It holds from the next API call; an SMTP connection that logged in before is checked again at its next message. The key itself and its mode (live or test) never change: for another, create a new key. - The portal shows when a key was last used (to the minute). - **In the portal, lasting access asks for a recent two-factor code** (at most 10 minutes old): creating a key or giving it more, adding a webhook endpoint, changing its URL, rotating its secret or deleting it, adding or removing a domain, removing a suppression and exporting messages or suppressions. The code is asked once and then covers the next 10 minutes. Calls with an API key never ask for it: scripts and servers keep working as they are. ## Live and test keys | What | Live key `pk_live_…` | Test key `pk_test_…` | |---|---|---| | Checks (sender domain, restrictions, suppression list, validation) | yes | the same | | Delivers mail | yes | never: every message gets simulated events at once | | Sandbox and probation limits | yes, while the organization is in the sandbox or the probation after it | no | | Volume limit | your [project](errors.md#project-limits) and [plan limits](errors.md#plan-limits), and the [platform limits](errors.md#platform-limits) | a limit of its own instead: 3,000 recipients a minute and 100,000 a day per project, see [Platform limits](errors.md#platform-limits) | | Counts as usage | yes | no | | Scopes | any | `emails:send`, `emails:read` and `domains:read` at most | Test and live messages are kept apart: a test key finds only test messages and a live key only live ones; the other kind answers `404`. Webhook endpoints have a mode too: a test endpoint gets the events of test messages only. The simulator addresses are in [Suppressions and test mode](suppressions.md#test-mode). ## Scopes A key has one or more scopes. A call outside them answers `403` with `{"error": "insufficient_scope"}`. | Scope | Allows | |---|---| | `emails:send` | `POST /v1/emails`, and SMTP submission | | `emails:read` | `GET /v1/emails/{id}`, `GET /v1/emails/problems` | | `domains:read` | `GET /v1/domains`, `GET /v1/domains/{id}`; also on a test key | | `domains:manage` | everything `domains:read` allows, plus `POST /v1/domains`, `DELETE /v1/domains/{id}`, `POST /v1/domains/{id}/check` | | `suppressions:read` | `GET /v1/suppressions`, also to check one address | | `suppressions:manage` | everything `suppressions:read` allows, plus `POST /v1/suppressions`, `DELETE /v1/suppressions/{id}` | | `webhooks:read` | `GET /v1/webhooks`, `GET /v1/webhooks/{id}`, `GET /v1/webhooks/{id}/deliveries`; never the signing secret | | `webhooks:manage` | everything under `/v1/webhooks` | | `inbound:read` | `GET` under `/v1/inbound`: receiving domains, routes, received messages with their content, attachments and raw mail (see [Inbound mail](inbound.md)); also on a test key | | `inbound:manage` | everything under `/v1/inbound` | | `usage:read` | `GET /v1/usage`, the project's usage per month (see [Usage](usage.md)); live keys only, never on by default | Give each key only what it needs: the key on a web server that sends sign-in codes needs `emails:send`, nothing more. A plugin that only shows its sender domain's status needs `domains:read`, not `domains:manage`; a dashboard that watches your suppressions and webhook deliveries needs `suppressions:read` and `webhooks:read`. ## Restrictions Two optional limits per key, set when you create it or later in the portal (at most 20 entries each): - **Sending domains.** The key sends only from these domains of the project. A message from another domain answers `422` with `{"error": "sender_domain_not_allowed_for_key"}`; over SMTP the `MAIL FROM` is refused with `553 5.7.1 sender_domain_not_allowed_for_key`. - **Networks.** The key works only from these networks: CIDR (`192.0.2.0/24`, `2001:db8::/32`) or a single address. The address must be the network's own (`10.0.0.0/8`, not `10.0.0.1/8`). From anywhere else the answer is `403` with `{"error": "client_ip_not_allowed"}`, and over SMTP the login fails with `535 5.7.1 client_ip_not_allowed`. Without restrictions a key sends from every verified domain of the project, from anywhere. ## Moving a key to another project An Owner or Admin can move a key to another project of the same organization, on the key's page in the portal. It is the same key: its value, prefix, scopes, networks and mode stay, so your integration keeps working without a change. - From the next call on, the key sends from the new project's domains and counts against **its** limits (plan, project and emergency limits). An SMTP connection that is already open switches at its next `MAIL FROM`. - What the key sent before stays with the old project, also in [`apiKey`](usage.md) of `GET /v1/usage`, which counts from the move on. - A key limited to sending domains moves only when the new project has those domains verified. Otherwise the portal refuses with `api_key_domains_not_in_target` and names the domains; the limit is never dropped for you. - Moving to another organization is not possible; that is a project transfer. ## Errors | Status | `error` | Why | |---|---|---| | `401` | `invalid_api_key` | no `Authorization: Bearer pk_…` header, or a key that does not exist or was revoked | | `403` | `insufficient_scope` | the key lacks the scope this call needs | | `403` | `client_ip_not_allowed` | the key is restricted to networks this request does not come from | | `403` | `organization_suspended` | Postilio suspended the key's organization; nothing is sent until it is resumed | | `403` | `project_suspended` | the key's project is paused or suspended, see [Paused projects](errors.md#paused-and-suspended-projects) | A key of an organization that is being deleted stops working too, until the deletion is cancelled. ## Response headers Every answer from `/v1` carries `Cache-Control: no-store`, so message data, recipients and webhook secrets are not kept in a browser or proxy cache. Over HTTPS the API sends `Strict-Transport-Security` as well: a browser that saw it uses only HTTPS for the API host from then on. The other browser security headers (`Content-Security-Policy`, `X-Content-Type-Options: nosniff`, `Referrer-Policy: no-referrer` and the like) are there too; a client on a server can ignore them. ## Signing in to the portal The portal itself is signed in to with an e-mail address, a password and a second factor; the API never uses them. Failed sign-ins are limited so that nobody can guess a password, or shut you out of your own account by failing on purpose: - **Per network.** All sign-in steps together, at most 20 attempts a minute from one network: an IPv4 address, or a whole IPv6 /64 (one subscriber's prefix, however many addresses it uses). - **Per account and network.** After 10 failed passwords for an address from one network in 15 minutes, that network gets `429 too_many_attempts` for the address. Other networks are not affected. - **Per account.** Failures for an address from everywhere count too. After 5 within an hour, a browser that never signed in to the account waits a little longer for each answer (1, 2, 4 … up to 10 seconds); after 50 it gets `429 too_many_attempts` until the hour is over. - **A browser you signed in with before keeps working.** After a correct password, the browser keeps a cookie for 90 days that exempts it from the per-account brake. Resetting your password via **Forgot your password?** gives the browser you reset it in that cookie too, so a lockout on a new device has a way out through your mailbox. - **You are told.** At 25 failures within an hour, the account's owner gets an e-mail (once an hour) and each of their organizations an entry *Failed sign-ins* in its audit log, with the number of failures and networks, never the addresses. Only failures count; a successful sign-in takes its attempt back. The answers are the same whether or not an address has an account: the same `401 invalid_credentials` for a wrong password and an unknown address, the same `429` and the same waiting time. ### Passwords A portal password has 12 to 256 characters; there are no rules about digits or symbols. A few unrelated words work well. Every new password (when you join, set up your account again, reset or change it) is also checked against [Have I Been Pwned's Pwned Passwords](https://haveibeenpwned.com/Passwords), a list of passwords from known data breaches (CC BY 4.0). A password on that list is refused with *This password appears in known data breaches. Choose another one.* The check uses k-anonymity: Postilio hashes the password with SHA-1 and sends only the first 5 of its 40 hex characters to `api.pwnedpasswords.com` (run behind Cloudflare, in the United States). The answer lists every known hash with that beginning, padded with fake entries so its size says nothing, and Postilio compares the rest of the hash itself. Your password, its full hash, your address and your account never leave Postilio, no cookies are sent, and none of it is logged. If the service does not answer within 2 seconds, the password is taken unchecked: the check never keeps you from setting a password. Source: https://docs.postilio.eu/sending.md # Sending email Send through the API with `POST /v1/emails`, or over SMTP from software that already speaks it. Both take the same route inside Postilio: the same checks, limits, suppression list and message log. ## Through the API ```sh curl https://api.postilio.eu/v1/emails \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "Acme ", "to": ["ada.lovelace@example.com"], "subject": "Your sign-in code", "text": "Your code is 482913.", "html": "

Your code is 482913.

", "tag": "sign-in", "replyTo": "support@example.com" }' ``` The key needs the `emails:send` scope. Examples in Node and C# are in the [Quickstart](quickstart.md#3-send-an-email). | Field | Rules | |---|---| | `from` | Required. An address on a verified domain of the project, optionally with a name: `Acme `. The name may be in any script. It may not contain `,`, `@` or a lookalike of `@` (the fullwidth `@` U+FF20 or the small `﹫` U+FE6B), also not inside an encoded word (`=?utf-8?q?…?=`): `400` under `errors.from`, over SMTP too. | | `to` | Required. 1 to 50 addresses, each a bare address without a name. | | `cc`, `bcc` | Optional. Bare addresses, only with exactly one address in `to`: see [Cc and Bcc](#cc-and-bcc). | | `subject` | Required. At most 998 characters, no control characters. | | `text`, `html` | At least one of the two. Send both and mail clients pick. | | `tag` | Optional. Up to 64 letters, digits, `-` or `_`; filter on it in the portal and find it in webhook events. | | `replyTo` | Optional. One address, with or without a name. | | `attachments` | Optional. Up to 20 files: `fileName`, `contentType` (`application/pdf`), `content` (base64). One with a `contentId` is inline: the HTML refers to it as `cid:` plus that id. | | `headers` | Optional. Up to 10 headers of your own, such as `List-Unsubscribe`: see [Custom headers](#custom-headers). | | `sendAt` | Optional. When to send it, from a minute to 30 days ahead: see [Scheduled sending](#scheduled-sending). | A message is at most 10 MB, attachments included (`413 message_too_large`), and its size times the number of recipients at most 25 MB (`413 message_too_large_for_recipients`): send to fewer recipients at a time then. See [Message size](errors.md#message-size) for what counts. Everything a request can hold is in the [reference](reference.md#send-email). ### Attachments Postilio never sends executable files: an attachment whose `fileName` ends in `.exe`, `.js`, `.vbs`, `.scr`, `.bat`, `.cmd`, `.jar`, `.iso`, `.lnk`, `.hta` or `.msi` refuses the whole message with `422 attachment_type_not_allowed` (over SMTP `550 5.7.1 attachment_type_not_allowed`), and its `message` names the file. Mailbox providers such as Gmail refuse them too. Put such a file behind a download link instead. ### The answer `202 Accepted` means Postilio has stored the message and will deliver it: ```json { "ids": ["01a10ce5-a09a-788b-9243-d7c9c59773d2", "01a10ce5-a09a-7dde-9fde-5676dcbd0094"], "suppressed": [] } ``` Every recipient becomes a message of its own with its own id, in the order of `to`, then `cc`, then `bcc`. A recipient on the project's suppression list is accepted but not sent: it is listed in `suppressed` and its message gets the status `suppressed` (see [Suppressions](suppressions.md)). A request that cannot be sent answers an error and stores nothing; [Errors and limits](errors.md) lists them. The common ones: `400` for a field that is not valid, `422` with `unverified_sender_domain` when the sender's domain is not verified (yet), in the sandbox `422 sandbox_recipient_not_allowed` and `429`, in the first weeks after it `429` over the [probation](errors.md#probation-after-the-sandbox)'s cap, `429` over a project's own limit, and `413` for a message that is too large. While Postilio protects its storage it answers `503 service_degraded` with a `Retry-After`: nothing was stored, so send the same request again after that many seconds. To send safely again after a timeout or a lost answer, add an `Idempotency-Key` header: see [Idempotency](idempotency.md). ### Cc and Bcc Every recipient gets a copy of their own, so without `cc` or `bcc` a message to several addresses in `to` shows each recipient only their own address. For a message that people should see was also sent to others, send it to one address in `to` and add `cc`, `bcc` or both: ```json { "from": "Acme Support ", "to": ["ada.lovelace@example.com"], "cc": ["account-manager@example.com"], "bcc": ["archive@example.com"], "subject": "Your ticket 4711", "text": "Solved: the export works again." } ``` - Every copy, the cc and bcc recipients' included, shows `To: ada.lovelace@example.com` and the `cc` addresses in `Cc:`. A `bcc` address appears in no header of any copy. - `cc` and `bcc` need **exactly one** address in `to`: with more, the answer is `422 cc_bcc_require_single_to` and nothing is sent. - `to`, `cc` and `bcc` together hold at most 50 addresses, and an address may appear only once over the three (`400`). - Every recipient is a message of its own, as with `to`: its own id (the answer lists `to`, then `cc`, then `bcc`), its own events and [webhooks](webhooks.md), and its own check against the suppression list and the sandbox. Each one counts towards your usage and every limit, and towards the size times the recipients (25 MB). - Events and webhooks of a message name its own recipient only; they go to you, never to the other recipients. ### Custom headers `headers` adds headers of your own to the message, as an object of names and values: ```sh curl https://api.postilio.eu/v1/emails \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "Acme ", "to": ["delivered@simulator.postilio.eu"], "subject": "What is new in October", "text": "Three new features. Unsubscribe: https://example.com/unsubscribe/3f9a1c7e", "tag": "newsletter", "headers": { "List-Unsubscribe": ", ", "List-Unsubscribe-Post": "List-Unsubscribe=One-Click", "X-Campaign-Id": "october-2026" } }' ``` | Header | Rules | |---|---| | `List-Unsubscribe` | One `` URL, one `` address, or both, separated by a comma; at most 512 characters. The URL must be on a public host name or address, without a user name, password or fragment. | | `List-Unsubscribe-Post` | Only `List-Unsubscribe=One-Click`, and only together with an https URL in `List-Unsubscribe` (one-click unsubscribe, RFC 8058). | | `In-Reply-To`, `References` | One or more message ids such as `<4711@mail.example.com>`, separated by a space: they place the message in a conversation. | | `X-…` | `X-` and up to 62 letters, digits or `-`, such as `X-Campaign-Id`. Not `X-Postilio-…`, `X-Tenant` or `X-Kumo…`. | - At most 10 headers. A name may appear once; names are not case-sensitive. - Every value is 1 to 900 printable ASCII characters on one line: no line breaks, control characters or accented letters. - Any other header cannot be set, so none of the headers Postilio writes itself can be replaced: `From`, `To`, `Cc`, `Bcc`, `Subject`, `Date`, `Message-ID`, `MIME-Version`, `Content-…`, `DKIM-Signature`, `Feedback-ID`, `Received` and `Return-Path`. Use the fields `from`, `to`, `subject` and `replyTo` instead. - A header that breaks a rule answers `400` with the reason under `errors.headers`, and nothing is sent. - Headers count towards the message size of 10 MB. - The DKIM signature covers `List-Unsubscribe`, `List-Unsubscribe-Post`, `In-Reply-To` and `References`, so a mailbox provider can trust them; `X-` headers are passed on unsigned. - Every recipient's message gets the same headers. Postilio does not change them, and does not act on them: an unsubscribe goes to your URL or address, and you stop sending. To have Postilio refuse an address from then on, add it to the [suppression list](suppressions.md). #### What recipients see Besides your own headers, every message carries: - **Two DKIM signatures.** One with `d=` your domain, which DMARC aligns on (see [Domains](domains.md#dmarc)), and one with `d=outbound.postilio.eu`, Postilio's own. The second one changes nothing for DMARC; it lets the large mailbox providers report spam complaints about all mail sent through Postilio to Postilio (Yahoo's complaint feedback loop, Gmail's Postmaster Tools), so a sender that draws complaints is found early. As Postilio moves its infrastructure to `pstlmta.net`, a third signature with `d=pstlmta.net` may join these two, for the same reason; it changes nothing for DMARC either. - **A `Feedback-ID` header**, such as `Feedback-ID: 3f1c2a9b7d04:9e8a61c05b2f:tx:postilio`, signed by the second signature. The first two parts stand for your project and your organization: short hashes, without names. Gmail counts complaints per part, never per recipient. - **A return path** (the envelope sender) like `b--@pst-bounces.` (`@bounce.` for domains added before that name), one per message and recipient. The code is a signature: only Postilio can make one, so a bounce to it is known to be about that message, and a forged one is ignored. Bounces to it are taken for 30 days. #### Unsubscribe and the large mailbox providers Gmail and Yahoo ask bulk senders (Gmail: about 5,000 messages a day or more to Gmail addresses) for one-click unsubscribe on **marketing and subscribed mail**: a `List-Unsubscribe` with an https URL plus `List-Unsubscribe-Post: List-Unsubscribe=One-Click`, both DKIM-signed, and a visible unsubscribe link in the message. A `mailto:` alone does not meet Gmail's requirement. Unsubscribes must be honoured within two days. **Transactional mail is exempt**: sign-in codes, password resets, receipts and order confirmations need no `List-Unsubscribe`. Since November 2025 Gmail rejects more non-compliant mail. For one-click, your URL takes a `POST` with the body `List-Unsubscribe=One-Click`, answers without a redirect, and needs no cookie or login: put a hard-to-guess token for the recipient in the URL itself. Sources, read on 2026-10-07: [Gmail sender guidelines](https://support.google.com/a/answer/81126) and [FAQ](https://support.google.com/a/answer/14229414), [Yahoo sender requirements](https://senders.yahooinc.com/faqs/), [RFC 8058](https://www.rfc-editor.org/rfc/rfc8058). ### Scheduled sending Add `sendAt` and the message waits until then, with the status `scheduled`: ```sh # An hour from now, in UTC (GNU date; on macOS: date -u -v+1H +%Y-%m-%dT%H:%M:%SZ). SEND_AT=$(date -u -d '+1 hour' +%Y-%m-%dT%H:%M:%SZ) curl https://api.postilio.eu/v1/emails \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "Acme ", "to": ["ada.lovelace@example.com"], "subject": "Your trial ends tomorrow", "text": "Your trial of Acme ends tomorrow at noon.", "tag": "trial-reminder", "sendAt": "'"$SEND_AT"'" }' ``` `sendAt` is an ISO 8601 date and time with `Z` (UTC) or an offset, such as `2026-11-02T09:00:00+01:00`. Without either, the time would be in nobody's zone in particular, so it is refused with a `400` under `errors.sendAt`. It is at least a minute and at most 30 days ahead (`422 send_at_too_soon`, `422 send_at_too_far`). Postilio hands the message to its mail server at that time; with many messages due at once, it can take a little longer. Until it goes out you can cancel it (scope `emails:send`): ```sh curl -X DELETE https://api.postilio.eu/v1/emails/$EMAIL_ID \ -H "Authorization: Bearer $POSTILIO_KEY" \ -w "%{http_code}\n" ``` `204` means it will not be sent: it gets the status `canceled`, a `canceled` event with the reason `canceled_by_request`, and its content is deleted. Once it is on its way, or for a message that was not scheduled, the answer is `409 email_not_scheduled`. Changing a scheduled message is cancelling it and sending a new one. What is checked when: - **When you send the request**, as for any message: the fields, the sender's domain, the sandbox, the suppression list, the size and the [storage protection](errors.md#status-codes). A project holds at most 10,000 scheduled messages, together at most 256 MB (`409 scheduled_limit_reached`, `409 scheduled_size_limit_reached`). - **When it is due**, again: the suppression list, the sender's domain and the sandbox. A message that may not go any more ends as `canceled`, with the reason `unverified_sender_domain` or `sandbox_recipient_not_allowed`. A suspended or paused project sends nothing until it is resumed; a message still waiting a day after its `sendAt` expires. - **Limits and usage count when it is due, not when you schedule it**: a message scheduled for next month counts in next month. When a per-minute limit is full, it waits for the next minute. When a daily or monthly limit is reached (the plan's, the project's or the platform's), it is not sent: it ends as `canceled` with the limit's code as the reason, such as `plan_monthly_limit_reached` (see [Errors and limits](errors.md)), and a webhook tells you. `cc`, `bcc` and `headers` work with `sendAt` as without. An `Idempotency-Key` with the same `sendAt` (the same moment, in any notation) answers with the same messages; with another `sendAt` it is a different request (`409 idempotency_key_reused_with_different_request`). A test key checks `sendAt` but simulates the message at once. Scheduling is for the API only: SMTP has no way to say when. ### What happens next Each message moves through these statuses. A status only moves forward, so events that arrive late do not move a message back; a bounce or a complaint after a delivery still wins. | Status | Meaning | |---|---| | `accepted` | stored, waiting to be handed to the mail server | | `scheduled` | stored, waiting for its `sendAt` | | `canceled` | not sent: canceled while scheduled, or no longer allowed when it was due (see `reason`) | | `queued` | handed to the mail server | | `deferred` | not delivered yet (the receiving server refused it for now, or could not be reached); it is tried again | | `delivered` | the receiving server accepted it | | `bounced` | refused for good, also when the bounce arrives after a delivery | | `expired` | not delivered within a day; no more attempts | | `complained` | the recipient marked it as spam | | `suppressed` | not sent, because the address is on the suppression list | Look a message up with `GET /v1/emails/{id}` (scope `emails:read`): ```sh curl https://api.postilio.eu/v1/emails/$EMAIL_ID \ -H "Authorization: Bearer $POSTILIO_KEY" ``` ```json { "id": "01a10ce5-a09a-788b-9243-d7c9c59773d2", "status": "bounced", "from": "no-reply@mail.example.com", "to": "bounced@simulator.postilio.eu", "subject": "Welcome to Acme", "tag": "welcome", "acceptedAt": "2026-10-05T16:28:57.882+00:00", "test": true, "via": "api", "events": [ { "type": "accepted", "occurredAt": "2026-10-05T16:28:57.882+00:00", "smtpCode": null, "response": null, "attempt": null, "remoteHost": null, "enhancedCode": null, "classification": null, "reason": null, "async": null }, { "type": "queued", "occurredAt": "2026-10-05T16:28:57.882+00:00", "smtpCode": null, "response": null, "attempt": null, "remoteHost": null, "enhancedCode": null, "classification": null, "reason": null, "async": null }, { "type": "bounced", "occurredAt": "2026-10-05T16:28:57.882+00:00", "smtpCode": 550, "response": "550 5.1.1 Simulated: the mailbox does not exist", "attempt": 1, "remoteHost": "mx.simulator.postilio.eu", "enhancedCode": "5.1.1", "classification": "InvalidRecipient", "reason": "recipient_rejected", "async": null } ] } ``` `via` is how the message came in: `api`, `smtp`, or `test_mail` for a [test email](test-emails.md). `subject` is `null` when the project does not keep subjects. The message log keeps no bodies or attachments. What `reason`, `response` and the codes of an event mean: [Delivery status and reasons](delivery-status.md). To hear about events as they happen instead of asking, use [Webhooks](webhooks.md). ## SMTP For software that sends mail over SMTP: point it at Postilio and log in with an API key. | Setting | Value | |---|---| | Host | `smtp.postilio.eu` | | Port | `587` with STARTTLS (recommended), or `465` with TLS from the first byte | | User name | `apikey` | | Password | an API key with the `emails:send` scope | Port 25 is not used: it is for traffic between mail servers, not for submitting mail. TLS 1.2 or 1.3 is required, and a login is accepted only after TLS is up. The host answers over IPv4 and IPv6, and sees your own address over both: a key limited to networks ([Restrictions](authentication.md#restrictions)) works over SMTP with IPv6 networks too. With curl (for `465`, use `smtps://smtp.postilio.eu:465` without `--ssl-reqd`): ```sh cat > welcome.eml <<'MAIL' From: Acme To: delivered@simulator.postilio.eu Subject: Welcome to Acme Hi Ada, your account is ready. MAIL curl smtp://smtp.postilio.eu:587 --ssl-reqd \ --user "apikey:$POSTILIO_KEY" \ --mail-from no-reply@mail.example.com \ --mail-rcpt delivered@simulator.postilio.eu \ --upload-file welcome.eml ``` In C#, with `System.Net.Mail`: ```csharp // Sends an email over SMTP submission: dotnet run SmtpSend.cs (.NET 10, no packages needed). // System.Net.Mail speaks STARTTLS (port 587) only; for TLS on port 465 use a library such as MailKit. using System.Net; using System.Net.Mail; using var smtp = new SmtpClient("smtp.postilio.eu", 587) { EnableSsl = true, // STARTTLS, before the login Credentials = new NetworkCredential("apikey", Environment.GetEnvironmentVariable("POSTILIO_KEY")), }; using var message = new MailMessage("Acme ", "delivered@simulator.postilio.eu", "Welcome to Acme", "Hi Ada, your account is ready."); await smtp.SendMailAsync(message); Console.WriteLine("Accepted"); ``` In Node, with nodemailer: ```js // Sends an email over SMTP submission with nodemailer: npm install nodemailer, then node smtp.mjs. import nodemailer from 'nodemailer'; const transport = nodemailer.createTransport({ host: 'smtp.postilio.eu', port: 587, // STARTTLS; for port 465 set secure: true secure: false, requireTLS: true, auth: { user: 'apikey', pass: process.env.POSTILIO_KEY }, }); const info = await transport.sendMail({ from: 'Acme ', to: 'delivered@simulator.postilio.eu', subject: 'Welcome to Acme', text: 'Hi Ada, your account is ready.', }); console.log(info.response); // 250 2.0.0 Ok: queued as ``` ### How a message is read - **The envelope decides the recipients** (`RCPT TO`): the `To` and `Cc` headers add no one, and a `Bcc` header is never passed on. - When the `To` header holds exactly one address and that address is a recipient, the message is read as the API's [Cc and Bcc](#cc-and-bcc): every copy shows that `To` and the `Cc` header's recipients, and every other recipient is a bcc. Otherwise (several `To` addresses, a `Cc` address that is not a recipient, `undisclosed-recipients:;`) every recipient gets a copy of its own that shows only their own address, as before. - The `From` header must hold exactly one address. It, and the envelope sender (`MAIL FROM`), must be on a verified domain of the key's project. - The first plain-text part and the first HTML part are the bodies; every other part is an attachment, inline when it has a `Content-ID`. `Reply-To` is kept; a tag cannot be set over SMTP. - `List-Unsubscribe`, `List-Unsubscribe-Post`, `In-Reply-To`, `References` and `X-` headers are kept when they follow the rules of [custom headers](#custom-headers). One that does not is **left out and the message is still sent**, so a mail client's own `X-` headers never stop a message; check a `List-Unsubscribe` with the API first if you rely on it. Every other header, and a `Bcc` header, is not passed on. - The answer to the message names the id of the first recipient's message: `250 2.0.0 Ok: queued as `, followed by `and 2 more` for more recipients and `; 1 suppressed recipient(s) not sent` when some are on the suppression list. - A client that sends a message again with the same `Message-ID` to the same recipients within 24 hours does not send it twice (see [Idempotency](idempotency.md#smtp)). ### Limits and replies | Limit | Reply | |---|---| | 10 MB per message, as sent (`SIZE` in the `EHLO` answer): over it at `MAIL FROM` with `SIZE=` | `552` | | … or as soon as the message outgrows it, after which the connection is closed | `552 5.3.4 message_too_large` | | 50 recipients per message: the rest go in a next message | `452 4.5.3` | | The size times the recipients at most 25 MB: with `SIZE=` the recipient over it, and the rest, go in a next message; without, the message after `DATA` | `452 4.5.3` at `RCPT TO`, or `552 5.3.4 message_too_large_for_recipients` | | 20 messages per connection: reconnect for more | `421 4.7.0` | | 600 messages per key per minute | `451 4.7.1` | | 10 connections at once from one address (over IPv6: one /64), of which 5 not logged in yet | the connection is closed | | 10 failed logins per 15 minutes from one address (over IPv6: one /64): wait | `454 4.7.0` | | Log in within 15 seconds of connecting, the TLS handshake included, and do not stay silent for more than 10 seconds before you do | the connection is closed | | Many connections at once that do not log in: Postilio keeps room for them, and when it is full a new connection closes the one that has waited longest without logging in. A client that logs in right after connecting is not affected | the connection is closed | | Reply | Why | |---|---| | `535 5.7.1 client_ip_not_allowed` | the key is restricted to other networks | | `535 5.7.1 insufficient_scope` | the key lacks `emails:send` | | `553 5.7.1 unverified_sender_domain` | the envelope sender's domain is not verified (at `MAIL FROM`) | | `550 5.7.1 unverified_sender_domain` | the `From` header's domain is not verified (after the message) | | `553 5.7.1` or `550 5.7.1 sender_domain_not_allowed_for_key` | the key may not send from that domain (envelope or `From` header) | | `550 5.7.1 sandbox_recipient_not_allowed` | in the sandbox, a recipient outside your team and verified domains | | `451 4.7.1 sandbox_daily_limit_reached`, `sandbox_rate_limit_reached` | a sandbox limit; a mail server tries again later | | `451 4.7.1 probation_daily_limit_reached`, `probation_rate_limit_reached` | the cap of the [probation](errors.md#probation-after-the-sandbox) after the sandbox; a mail server tries again later | | `451 4.7.1 project_daily_limit_reached`, `project_rate_limit_reached` | the project's own limit, see [Project limits](errors.md#project-limits); a mail server tries again later | | `451 4.7.1 plan_monthly_limit_reached`, `plan_daily_limit_reached`, `plan_rate_limit_reached` | a limit of your plan, see [Plan limits](errors.md#plan-limits); a mail server tries again later | | `451 4.7.1 platform_rate_limit_reached`, `platform_daily_limit_reached` | the platform's safety limit per key or project, or on a project's test keys, see [Platform limits](errors.md#platform-limits); a mail server tries again later | | `554 5.6.0` | the message is not valid: not MIME, no single From address, or a field the API would refuse (the reply names it) | | `550 5.7.1 attachment_type_not_allowed` | an attachment is an executable file, see [Attachments](#attachments) (the reply names it) | | `554 5.6.0 message_id_reused_with_different_content` | the same Message-ID with other content within 24 hours | | `554 5.7.1 organization_suspended` | Postilio suspended your organization; the connection is closed | | `554 5.7.1 project_suspended` | the key's project is paused or suspended, see [Paused projects](errors.md#paused-and-suspended-projects); the connection is closed | | `530 5.7.0` | the key was revoked during the session | | `530 5.7.1 client_ip_not_allowed`, `530 5.7.1 insufficient_scope` | the key was changed during the session and may no longer send from here; the connection is closed | | `452 4.3.1 service_degraded` | Postilio takes no new messages for now, to protect its storage; a mail server tries again later | | `451 4.3.0`, `451 4.3.2` | a temporary failure at Postilio, or busy; try again | Source: https://docs.postilio.eu/test-emails.md # Test emails Send one email from a verified domain to an address of your own, and see what happened to it: whether the receiving server took it, its reply and codes, or why it was refused. It is the quickest way to check a new domain end to end. In the portal it is **Test mail** in the sidebar, or **Test this domain** on a domain's page: there it sends Postilio's sample message from that domain once it is verified, or while it has been failing for less than 72 hours, and shows the last test from it. ## Who can get one A test email goes only to an address of your own, never to anyone else: - **a member's address**: any active member of your organization, no confirmation needed; - **a confirmed address**: under **Test mail** in the portal you add an address, such as a personal Gmail or Outlook mailbox; Postilio mails it a link, and the address can get test emails once someone opens that link (within 24 hours, once). The mail with the link only names the address itself. The address stays yours: in the portal only you send test emails to it, and it stops counting when you leave the organization. Through the API, a project's keys may send to any address a member of the organization confirmed in that project. Any other address answers `422 test_recipient_not_confirmed`, and nothing is sent. ## Through the API `POST /v1/emails/test` (scope `emails:send`) sends one test email. Without `subject`, `text` and `html` it sends Postilio's sample message; with them, your own (a `subject` and `text`, `html` or both): ```sh curl https://api.postilio.eu/v1/emails/test \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "no-reply@mail.example.com", "to": "ada@example.org" }' ``` The answer is `202` with the message's id: ```json { "id": "01a10ce5-a09a-788b-9243-d7c9c59773d2" } ``` Follow it with `GET /v1/emails/{id}`, as any message (see [Sending email](sending.md#what-happens-next)); its `via` is `test_mail`, and the message log lists it as a test email. A test key (`pk_test_`) sends nothing for real, here too. ## Limits A project sends at most **10 test emails per UTC day**, from the portal and the API together; over that the answer is `429 test_mail_daily_limit_reached` with a `Retry-After` until midnight UTC. A test email that is refused uses up nothing. Otherwise a test email is a send like any other: it counts towards your usage, and the sandbox, your plan's and the project's limits, paused projects and the [message size](errors.md#message-size) apply, with the same errors. In the sandbox, a confirmed address outside your organization's verified domains is still refused (`422 sandbox_recipient_not_allowed`). ## What Postilio can and can't see Postilio sees what the receiving server answered: delivered, deferred or refused, with its reply, the [enhanced code and reason](delivery-status.md). It can't see what the mailbox then did with the message: whether it went to the inbox or the spam folder, and how the receiver judged SPF, DKIM and DMARC. Only the mailbox shows that. Open the test email there and show its original or its headers: | Mailbox | Where | |---|---| | Gmail | **More** (⋮) next to Reply → **Show original**: a table at the top lists SPF, DKIM and DMARC. Only in a browser, not in the app | | Outlook.com, Microsoft 365 | **More actions** (…) → **View** → **View message details** | | Yahoo Mail | **More options** (…) → **View Raw Message** | | iCloud Mail | **More** (…) → **Show All Headers**; in Apple Mail on a Mac, **View** → **Message** → **All Headers** | | Proton Mail | **More** (⋮) → **View headers** | | GMX, WEB.DE | the **(i)** symbol in the message (GMX), or **⋮** → **Mehr Informationen** (WEB.DE) | | Fastmail | **Actions** → **Show raw message** | Look for the `Authentication-Results` line: `spf=pass`, `dkim=pass` and `dmarc=pass` mean the receiver accepted your domain's setup. Menus change now and then; the labels are as of October 2026. The portal can read that line for you: paste the headers, or the whole original message, under **How did it arrive?** on **Test this domain** or **Test mail**. Your browser reads the top `Authentication-Results` and shows SPF, DKIM and DMARC, and whether each matches your domain; nothing you paste is sent to Postilio or kept. When the top one comes from a server that forwarded the message and changed it, it says so: that is most likely not your DNS. Source: https://docs.postilio.eu/delivery-status.md # Delivery status and reasons Every attempt to deliver a message is an event in its timeline (`GET /v1/emails/{id}`, and the same fields in a [webhook](webhooks.md)). This page explains what an event tells you about a delay or a failure. ## What an event holds | Field | Meaning | |---|---| | `smtpCode`, `enhancedCode` | the receiving server's reply code, such as `451` and `4.7.1`; `null` when no server replied, for example when no connection could be made | | `response` | the receiving server's reply, word for word but with e-mail addresses and IP addresses masked (`ad•••@example.com`, `•••`); when no server replied, a sentence that says what happened | | `reason` | why the attempt was delayed or failed, as a stable code from the tables below; `null` when there is nothing to explain, such as on a delivery | | `remoteHost` | the receiving mail server Postilio connected to, when it got that far | | `classification` | for a bounce: what kind of refusal the reply is, such as `InvalidRecipient` | | `async` | `true` on a report that arrived after delivery ([below](#a-bounce-after-delivery)); left out (`null`) otherwise | Build on `reason` and `smtpCode`, not on the text of `response`: receiving servers word their replies as they like, and our own sentences may be improved. A reason code never changes meaning; new codes may be added, so treat an unknown code like `unknown_temporary` (on a `deferred` event) or `unknown_permanent` (on a `bounced` one). ## The receiving server replied The reply stays visible in `response`, with `smtpCode` and `enhancedCode`. | Reason | Meaning | |---|---| | `recipient_server_temporary` | the server refused for now (a 4xx reply), greylisting included; Postilio retries | | `rate_limited_by_recipient` | the server asks Postilio to slow down; Postilio retries later | | `mailbox_full` | the recipient's mailbox is full (temporary or permanent, see `smtpCode`) | | `recipient_rejected` | the server refused the message for good (a 5xx reply); see `response` and `classification` for why | ## No server replied `response` holds one of these sentences, and `smtpCode` is `null`. | Reason | `response` | |---|---| | `tls_certificate_invalid` | We couldn't set up a secure connection to the recipient's mail server. We'll retry. | | `tls_failed` | The secure connection to the recipient's mail server failed. We'll retry. | | `connection_timeout` | The recipient's mail server didn't respond in time. We'll retry. | | `connection_failed` | We couldn't connect to the recipient's mail server. We'll retry. | | `ipv6_candidate_failed` | A connection to one of the recipient's mail servers failed. We'll retry. | | `dns_or_mx_failed` | We couldn't find a reachable mail server for the recipient's domain. | | `delivery_paced` | We're pacing delivery to this mailbox provider to protect deliverability. We'll retry. | | `delivery_paused` | Delivery is paused on our side for the moment. We'll retry. | | `retry_period_ended` | We stopped retrying: the message could not be delivered within its retry period. | | `unknown_temporary` | Delivery was delayed by a temporary problem. We'll retry. | | `unknown_permanent` | We couldn't deliver this message. | `tls_certificate_invalid` usually means the recipient's mail server presents a certificate for another name: a setting at the recipient's mail provider. Postilio retries, and delivers as soon as the server is reachable securely. ## A scheduled message that was not sent A [scheduled](sending.md#scheduled-sending) message that will not go out ends with a `canceled` event. Its `reason`: | Reason | Meaning | |---|---| | `canceled_by_request` | you canceled it (`DELETE /v1/emails/{id}`, or in the portal) | | `lost_in_restore` | Postilio restored its database from a backup, which never holds message content (see [Data retention](data-retention.md)); send it again | | `unverified_sender_domain` | when it was due, the sender's domain could not send: no longer verified, or removed | | `sandbox_recipient_not_allowed` | when it was due, the organization was in the sandbox and the recipient outside it | | `plan_monthly_limit_reached`, `plan_daily_limit_reached`, `sandbox_daily_limit_reached`, `probation_daily_limit_reached`, `project_daily_limit_reached`, `platform_daily_limit_reached` | when it was due, that limit was reached (see [Errors and limits](errors.md)) | ## A bounce after delivery Some mail servers accept a message and only later find they cannot deliver it, for example a forwarding address that no longer exists. They send a delivery status report (a bounce, RFC 3464) to the message's return path, which Postilio receives. The message then gets a second `bounced` event after its `delivered` one, and its status becomes `bounced`: | Field | Value | |---|---| | `reason` | `async_bounce` | | `async` | `true` | | `smtpCode`, `enhancedCode`, `classification` | from the report: the reply code it quotes and its status | | `response` | the receiving server's reply the report quotes, with addresses (all but the domain), IP addresses and identifiers removed, at most 200 characters; `null` when the report quotes none | | `remoteHost` | the receiving server that sent the message back, when the report names it; else `null` | | `attempt` | `null`: no connection of ours was involved | A message gets at most one such event, however many reports arrive for it. A permanent failure on the address itself (`classification` `InvalidRecipient`, `BadDomain` or `InactiveMailbox`, with a `5xx` code) puts the recipient on the project's [suppression list](suppressions.md), as a bounce during delivery does. Postilio counts a report only when it names a message it sent in the last 30 days through a return path only that message's recipient saw, and only up to a number of reports per project and recipient domain a day, so a forged or flooded report cannot suppress your addresses or pause your sending. Reports beyond that are kept for Postilio's own abuse checks and do not show here. ## A complaint after delivery When a recipient marks a message as spam, some mailbox providers tell the sender through a feedback loop (an ARF report, RFC 5965); Postilio receives those of Yahoo and AOL, and adds others once their reports are known. The message then gets a `complained` event after its `delivered` one, and its status becomes `complained`: | Field | Value | |---|---| | `reason` | `feedback_loop` | | `async` | `true` | | `response` | Postilio's own sentence, such as `Marked as spam through the feedback loop of yahoo.com` | | `smtpCode`, `enhancedCode`, `remoteHost`, `attempt` | `null` | The recipient goes on the project's [suppression list](suppressions.md) with the reason `complaint`. A message gets at most one such event. Postilio counts a complaint only when the report is signed by the feedback loop itself and names a message it sent in the last 30 days through a return path only that message's recipient saw. Anyone who received a message can write a report about it, so one that someone forwards by hand, or that is not signed by a known feedback loop, is kept for Postilio's own abuse checks and changes nothing, nor does a report that a message is *not* spam. Complaints count towards the [automatic pause](errors.md#paused-and-suspended-projects) only when they come from at least 10 different recipients. ## Problems at a glance `GET /v1/emails/problems` (scope `emails:read`) counts the messages of the last 24 hours (`period=24h`, the default) or 7 days (`period=7d`) that are `deferred`, `bounced`, `complained` or `expired` now. It groups them by status and `reason`, gives each group's count per sender domain, and the ids of up to 5 of the newest, to look up with `GET /v1/emails/{id}`. It never lists a recipient. `domain` counts only that sender domain; a test key counts only test messages. ```sh curl "https://api.postilio.eu/v1/emails/problems?period=7d" \ -H "Authorization: Bearer $POSTILIO_KEY" ``` ```json { "period": "7d", "from": "2026-10-16T00:00:00+00:00", "to": "2026-10-22T14:05:09+00:00", "domain": null, "data": [ { "status": "bounced", "reason": "recipient_rejected", "messages": 12, "byDomain": [{ "domain": "mail.example.com", "messages": 12 }], "examples": ["01929a3c-5e1f-7a4b-9c2d-3e4f5a6b7c8d"] } ] } ``` A group's `reason` is that of the event that set the status, and `null` when there is none, as on a complaint. Groups come with the most messages first. ## Retries A deferred message is retried with growing pauses, starting at about two minutes and doubling up to two hours, for up to a day after it was accepted. After that it is `expired`, with the reason `retry_period_ended`. Source: https://docs.postilio.eu/domains.md # Sending domains You send from addresses on your own domains. Before Postilio sends from a domain, three DNS records prove it is yours and let Postilio sign the mail (DKIM) and receive its bounces (the return path). A domain belongs to one project. ## Add a domain In the portal under **Domains**, or with a key that has the `domains:manage` scope: ```sh curl https://api.postilio.eu/v1/domains \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "mail.example.com" }' ``` The name needs at least two labels and may not be an IP address. Postilio stores it in lowercase, without a trailing dot. A subdomain such as `mail.example.com` keeps your transactional mail apart from the rest of your domain's mail. `postilio.eu`, `pstlmta.net` and every name under them are Postilio's own and cannot be added. A name the project has already answers `409` with `{"error": "domain_exists"}`. The answer is the domain with the status `pending` and the records to create: ```json { "id": "01a1081b-eb5c-7685-ab38-fdd4a4ab10e5", "name": "mail.example.com", "status": "pending", "checkedAt": null, "records": [ { "type": "CNAME", "name": "pst1._domainkey.mail.example.com", "value": "pst1.ft6sub3lbo.dkim.pstlmta.net", "status": "unknown" }, { "type": "CNAME", "name": "pst2._domainkey.mail.example.com", "value": "pst2.ft6sub3lbo.dkim.pstlmta.net", "status": "unknown" }, { "type": "CNAME", "name": "pst-bounces.mail.example.com", "value": "rp.pstlmta.net", "status": "unknown" } ], "createdAt": "2026-10-04T18:10:09.884+00:00", "addedBy": null, "failingSince": null, "sent30d": 0, "dmarc": null, "platformKey": { "type": "TXT", "name": "pst1.ft6sub3lbo.dkim.pstlmta.net", "status": "publishing" } } ``` ## The records | Record | Points to | What it is for | |---|---|---| | `pst1._domainkey.` and `pst2._domainkey.` | `pst1..dkim.pstlmta.net` and `pst2..dkim.pstlmta.net` | **DKIM.** Postilio signs your mail with a key of this domain's own and publishes its public half in its own zone; your CNAMEs point there. Two selectors, so Postilio can replace the key behind the one it does not sign with, without you changing a record. | | `pst-bounces.` | `rp.pstlmta.net` | **Return path.** The envelope sender of your mail is on `pst-bounces.`, so bounces come back to Postilio, and SPF is checked against Postilio's servers through this CNAME. | Domains added before these names existed have one DKIM record with a dated selector (`pst202610._domainkey.`) and their return path on `bounce.`. They keep those names and keep working: the answer always shows the names that count for your domain. Postilio is moving these targets to `pstlmta.net` (`..dkim.pstlmta.net`, `rp.pstlmta.net`), and a domain keeps the targets it was added with. Always use the values your domain shows; both kinds work ([Older and newer record values](#older-and-newer-record-values)). Create them as CNAME records with exactly the names and values the portal or the API shows; the selector and token are your domain's own. Postilio publishes the record your DKIM CNAME points to itself; the domain is verified once that one is found too. It is not one for you to create: `platformKey` says where it stands. With `pst1` and `pst2`, Postilio publishes a key behind each: the one it signs with, and a standby key of its own behind the other selector, ready for a key rotation. `platformKey` is `published` once both are found; the domain's status only ever waits for the one it signs with, so a standby key that is not published yet never stops your mail. | `platformKey.status` | Meaning | |---|---| | `publishing` | Postilio is publishing it, or it was published and the next check will find it. Usually a minute. | | `published` | found in DNS at the last check. | | `failed` | publishing it keeps failing. Postilio's team is alerted and it is retried every 30 seconds; nothing to do on your side. | | `manual` | this Postilio installation publishes these records by hand; its operator is alerted when one is missing. | So when your records are `found` and the domain is still `pending`, it waits for Postilio's record, and `platformKey` tells you why. ### Older and newer record values Postilio moves its own DNS names from `postilio.eu` to its infrastructure domain `pstlmta.net` (`..dkim.pstlmta.net`, `rp.pstlmta.net`). A domain keeps the values it was added with: the records in the answer are always the ones that count for your domain, and an older value keeps working. Once Postilio recommends the move, a record that still points at an older name carries `newValue`, today's value for it: ```json { "type": "CNAME", "name": "bounce.mail.example.com", "value": "rp.postilio.eu", "status": "found", "newValue": "rp.pstlmta.net" } ``` Point the record at `newValue` when it suits you, record by record; there is no deadline. At the next check (or `POST /v1/domains/{id}/check`) the record is `found` on the new value, `value` becomes it and `newValue` is gone. The domain stays verified throughout. A record without `newValue` needs nothing. See [Migrate your domain](migrate-domain.md). A domain with the older names (a dated DKIM selector, `bounce.`) is offered the new names with the move. Its records then carry `newName` too, the name to create with `newValue`, and the domain has `newRecords`: the second DKIM selector, which does not exist yet. ```json { "records": [ { "type": "CNAME", "name": "pst202610._domainkey.mail.example.com", "value": "pst202610.ft6sub3lbo.dkim.postilio.eu", "status": "found", "newValue": "pst1.ft6sub3lbo.dkim.pstlmta.net", "newName": "pst1._domainkey.mail.example.com" }, { "type": "CNAME", "name": "bounce.mail.example.com", "value": "rp.postilio.eu", "status": "found", "newValue": "rp.pstlmta.net", "newName": "pst-bounces.mail.example.com" } ], "newRecords": [ { "type": "CNAME", "name": "pst2._domainkey.mail.example.com", "value": "pst2.ft6sub3lbo.dkim.pstlmta.net", "status": "missing" } ] } ``` Create the new records next to the old ones; leave the old ones in place. Each record moves on its own once the new one is found: `pst1` makes the domain sign with `pst1` (the same key), `pst-bounces` moves its return path. The answer then shows the new record in place of the old one, and `pst2` among the records. Until then the old record counts as before, and `newRecords` never counts towards the status. With all three new records found, Postilio can rotate the domain's DKIM key without you changing DNS again. ## DMARC DMARC tells receivers what to do with mail that uses your domain in its From address but is not authenticated for it. Mail sent through Postilio passes DMARC on DKIM: it is signed with `d=` exactly your domain, so it aligns even with strict DKIM alignment (`adkim=s`). The return path is on `pst-bounces.` (`bounce.` for older domains), so SPF aligns only in relaxed mode (`aspf=r`, the default); with `aspf=s` DMARC rests on DKIM alone, which is enough. Your mail also carries a second signature, `d=outbound.postilio.eu`, for the mailbox providers' complaint reports ([What recipients see](sending.md#what-recipients-see)); it does not align with your domain and does not need to: one aligned, valid signature is what DMARC asks. A third one, `d=pstlmta.net`, may join it for the same purpose; that changes nothing for DMARC either. Sending through Postilio never depends on a DMARC record; it is advice. The large mailbox providers do ask for one from bulk senders: [Gmail](https://support.google.com/a/answer/81126) from senders of more than 5,000 messages a day to Gmail accounts, [Microsoft](https://support.microsoft.com/outlook/fix-ndr-error-550-5-7-515-in-outlook-com) from senders of 5,000 or more a day to Outlook.com, Hotmail and Live, and [Yahoo](https://senders.yahooinc.com/best-practices/) from bulk senders without naming a number. For all three, `p=none` is enough. At every check Postilio reads the domain's DMARC record as receivers find it (RFC 9989): its own at `_dmarc.`, or else the record of its organizational domain, found by walking up the DNS tree (at most eight lookups; a `psd=` tag on the way decides where the walk stops). What each tag of the record does is on [DMARC tags](dmarc.md). The answer is in `dmarc`, which is `null` until the first check: ```json "dmarc": { "status": "monitoring", "policyDomain": "mail.example.com", "records": ["v=DMARC1; p=none"], "issues": ["no_reports"], "policy": "none", "testing": false } ``` | Status | Meaning | |---|---| | `missing` | no record on the domain or a parent. | | `invalid` | receivers ignore the record. `issues` says why: `multiple_records` (more than one at the same name), `version` (it does not start with `v=DMARC1`) or `syntax` (a tag with a value receivers do not accept). | | `monitoring` | the policy that applies is `none`: receivers report on mail that fails, but deliver it as usual. A record without `p=` counts as `p=none`. | | `enforced` | `quarantine` or `reject` applies. | `policy` is the policy receivers apply to mail that fails: `none`, `quarantine` or `reject` (`null` while missing or invalid). With `t=y` the owner is testing, `testing` is `true`, and receivers apply one step less: `p=quarantine; t=y` applies `none`, `p=reject; t=y` applies `quarantine`. For a subdomain without a record of its own, the `sp=` tag of the record found is the policy when it has one. `issues` can also hold advice on a record receivers use: `no_reports` (the policy is `none` and there is no `rua=` address, so nobody receives the reports), `spf_strict` (`aspf=s`, see above), `obsolete_tag` (`pct=`, `rf=` or `ri=`: no longer part of DMARC, receivers ignore them; use `t=y` instead of `pct=`) and `invalid_policy` (`p=`, `sp=` or `np=` has a value receivers do not accept, but `rua=` is valid, so they act as if the record said `p=none`). To start, add a TXT record such as `_dmarc.mail.example.com TXT "v=DMARC1; p=none; adkim=s; aspf=r"`, with `rua=mailto:` and an address of yours to receive the aggregate reports. Once the reports show that all your mail passes, including mail other services send for the domain, move to `p=quarantine` and later to `p=reject`, each time first with `t=y` while you watch the reports. ## Statuses | Status | Meaning | |---|---| | `pending` | added; not all records found yet. Nothing can be sent from it. | | `partially_verified` | everything needed to send is found: the DKIM record of the selector Postilio signs with, the return path and Postilio's key. The other DKIM selector's record is missing; add it, or Postilio cannot replace the key later without your help. You can send from any address on the domain. | | `verified` | all records found. You can send from any address on the domain. | | `failing` | it was verified, but a record went missing. It keeps sending for 72 hours after `failingSince`, so a DNS slip does not stop your mail at once; after that, sends answer `422 unverified_sender_domain` until the records are back. | Each record has its own status too: `found`, `missing`, or `unknown` before the first check. A domain that was `failing` becomes `verified` again as soon as its records are found. ## Checks Postilio checks every domain's records every 10 minutes. To check one now, press **Check now** in the portal or: ```sh curl -X POST https://api.postilio.eu/v1/domains/$DOMAIN_ID/check \ -H "Authorization: Bearer $POSTILIO_KEY" ``` It answers the domain with its new status. One check per domain per minute: sooner answers `429` with `{"error": "too_many_checks"}` and a `Retry-After` header. When DNS gave no answer at all, the status stays as it was and the answer is `503` with `{"error": "dns_unavailable"}`; try again a little later. ## List and remove `GET /v1/domains` lists the project's domains and `GET /v1/domains/{id}` reads one; both need `domains:read` (or `domains:manage`, which includes it), which a test key may have too. `sent30d` is the number of live messages sent from the domain today and the 29 days before. `DELETE /v1/domains/{id}` removes a domain (scope `domains:manage`): mail from it stops at once. Delete its DNS records afterwards. Source: https://docs.postilio.eu/migrate-domain.md # Migrate your domain ## What changes Postilio moves the DNS names your records point at from `postilio.eu` to `pstlmta.net`, a domain used only for Postilio's mail infrastructure. `postilio.eu` stays the name of the website, the portal, the API and SMTP; only the targets of your records change. | Record | Older value | Newer value | |---|---|---| | `._domainkey.` (DKIM) | `..dkim.postilio.eu` | `..dkim.pstlmta.net` | | Return path | `bounce.` → `rp.postilio.eu` | `pst-bounces.` → `rp.pstlmta.net` | | MX of a receiving domain ([Inbound mail](inbound.md)) | `10 inbound.postilio.eu` | `10 mx1.pstlmta.net` | A domain added before the selector pair has one DKIM record with a dated selector (`pst202610._domainkey.`) and its return path on `bounce.`. The move gives it the new names too, so you change your DNS once: | Older record | Newer record | |---|---| | `pst202610._domainkey.` → `pst202610..dkim.postilio.eu` | `pst1._domainkey.` → `pst1..dkim.pstlmta.net` | | (none) | `pst2._domainkey.` → `pst2..dkim.pstlmta.net`, the spare selector | | `bounce.` → `rp.postilio.eu` | `pst-bounces.` → `rp.pstlmta.net` | With `pst1` and `pst2` Postilio can rotate your DKIM key without you changing a record again. A domain that moved to `pstlmta.net` earlier with the older names is offered the new names the same way, only for the records that still differ. Domains added after the move get the newer values straight away. Domains added before keep working on the older values: nothing stops, nothing fails, and there is no deadline. We recommend moving them anyway, so all your mail uses the names Postilio maintains from now on. ## How to move a domain In the portal, open the domain and choose **Migrate domain**. Each record shows its older and newer value side by side. 1. At your DNS provider, create the newer record (name and value) next to the older one. Where only the value changes, change the value and keep the name. The type stays CNAME. 2. Choose **Check now** next to the record. Once the new record is found, it shows **Found · migrated**. 3. Do the next record. You can move them one at a time, on different days; stopping halfway breaks nothing. A receiving domain ([Inbound mail](inbound.md)) shows the newer MX value on its own page, next to the current one. Change the MX record's host and choose **Check now** there. Your domain stays verified during the move: each record counts on its older or its newer value, and Postilio publishes your DKIM key at both. Mail keeps being signed with the same key; once `pst1` is found, with `pst1` as the selector. Keep the older records for a while after the move: mail signed or sent before it may still be on its way, and Postilio keeps the records they point at published. Until `pst2` is found too the domain shows **Partially verified**; it sends as before. With the API, a record that still points at an older value carries `newValue` (and `newName` when its name changes, with the record to add in `newRecords`) ([Older and newer record values](domains.md#older-and-newer-record-values)); `POST /v1/domains/{id}/check` checks it at once. ## If something goes wrong A record that is neither on its older nor on its newer value is `missing`, as before, and the domain goes `failing` after the usual checks ([Statuses](domains.md#statuses)). Point it back at either value and choose **Check now**. Using Cloudflare? Set the CNAME to **DNS only** (grey cloud), as for any of these records. Source: https://docs.postilio.eu/webhooks.md # Webhooks Postilio posts the events of your messages to an HTTPS endpoint of yours, so you do not have to poll `GET /v1/emails/{id}`. Deliveries are signed with the [Standard Webhooks](https://www.standardwebhooks.com/) scheme, so any Standard Webhooks library can verify them, and so can the few lines below. ## Endpoints Add an endpoint on the portal's **Webhooks** page, or with an API key that has the `webhooks:manage` scope: ```sh curl https://api.postilio.eu/v1/webhooks \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://api.example.com/hooks/postilio", "events": ["delivered", "bounced", "complained"] }' ``` The answer holds the signing secret (`whsec_…`). **It is shown this once**; Postilio keeps it encrypted and never returns it again. Rotate it to get a new one. | Call | What it does | |---|---| | `GET /v1/webhooks` | your endpoints | | `POST /v1/webhooks` | add one: `url` (HTTPS), `events`, optional `description`, `mode` (`live` or `test`) | | `GET /v1/webhooks/{id}` | read one | | `PATCH /v1/webhooks/{id}` | change `url`, `events`, `description` or `paused`; what you leave out stays as it is | | `DELETE /v1/webhooks/{id}` | remove it | | `POST /v1/webhooks/{id}/secret` | rotate the secret; the old one keeps signing for 24 hours | | `POST /v1/webhooks/{id}/test` | send a `webhook.test.v1` event, once (no retries), also to a paused endpoint | | `GET /v1/webhooks/{id}/deliveries` | the delivery log: attempts, status codes, errors (`status`, `before`, `limit`) | | `POST /v1/webhooks/{id}/deliveries/{deliveryId}/retry` | one more attempt right away, same id and payload (resume a paused endpoint first) | Reading (`GET` on your endpoints and their deliveries) needs `webhooks:read` or `webhooks:manage`; everything else needs `webhooks:manage`. No call returns the secret after the answer that created or rotated it. A project has at most 10 endpoints, and your organization as many as its plan allows (see [Plan limits](errors.md#plan-limits)). A **test** endpoint only gets the events of messages sent with a `pk_test_` key; a live endpoint never does. Test keys cannot manage webhooks. ### Moving an endpoint to another project An Owner or Admin can move an endpoint to another project of the same organization, on its settings page in the portal. Its URL, events, mode and signing secret stay, so your receiver keeps verifying as before. From then on it gets the events of the new project. Deliveries so far stay with the old project, and retries that are still open finish as they were: same `webhook-id`, same payload, same URL. The move is refused with `webhook_endpoint_limit_reached` when the new project already has 10 endpoints, and with `webhook_url_not_allowed` when the URL no longer passes the [address check](#which-urls-are-allowed). Moving to another organization is not possible; that is a project transfer. ### Which URLs are allowed Postilio connects only to public addresses, so a webhook cannot be used to reach anything on Postilio's own network: - `https://` only, at most 2048 characters, without credentials (`user:pass@`) or a `#fragment`. Authenticate deliveries by their signature; a token in the query string is fine. - No private, loopback, link-local (cloud metadata), shared, documentation, multicast or reserved addresses, for IPv4 and IPv6 alike. A host name without a dot, or ending in `.localhost` or `.internal`, is refused when you add it. - The check runs again on **every delivery**, against the addresses the host name resolves to at that moment, and the connection goes to the address that was checked. A name that later points somewhere private gets its deliveries refused, and they count as failed. ### Try it: the test event Send a test event to see that your endpoint is reachable and verifies the signature: ```sh curl -X POST https://api.postilio.eu/v1/webhooks/$WEBHOOK_ID/test \ -H "Authorization: Bearer $POSTILIO_KEY" ``` It answers `202` with the delivery, which is tried once right away, also when the endpoint is paused. Look at the result in the delivery log, with the status code your endpoint answered and the start of its body: ```sh curl "https://api.postilio.eu/v1/webhooks/$WEBHOOK_ID/deliveries?limit=5" \ -H "Authorization: Bearer $POSTILIO_KEY" ``` ## Events and payload | Event | When | |---|---| | `accepted` | the API or SMTP took the message | | `queued` | handed to the mail server | | `delivered` | the receiving server accepted it | | `deferred` | a temporary failure; it is retried | | `bounced` | refused for good (also a bounce that arrives later) | | `expired` | not delivered within a day | | `complained` | the recipient marked it as spam | | `suppressed` | not sent: the address is on the suppression list | | `scheduled` | the message waits for its `sendAt` ([Scheduled sending](sending.md#scheduled-sending)); `data.sendAt` says when | | `canceled` | a scheduled message will not be sent: canceled, or no longer allowed when it was due; `data.reason` says why | | `inbound` | a message arrived at one of your inbound routes: `inbound.received.v1`, see [Inbound mail](#inbound-mail-inbound-received-v1) | An endpoint gets only the events it chose: one made before `scheduled` and `canceled` existed does not get them until you add them to its `events`. The body is JSON. `type` carries the version: a change that is not backwards compatible gets a new type (`email.delivered.v2`) instead of changing this one. Fields without a value are left out, and new fields may be added. Email events never carry message content: no subject, no body. The inbound event does, because that is what it is for. `reason`, `response` and the codes mean the same as in a message's timeline: see [Delivery status and reasons](delivery-status.md). A scheduled message's events also carry `sendAt`. A bounce that arrived after delivery carries `"async": true` and `"reason": "async_bounce"` ([A bounce after delivery](delivery-status.md#a-bounce-after-delivery)); its `email.bounced.v1` can follow an `email.delivered.v1` for the same `emailId`, hours or days later. A complaint carries `"async": true` and `"reason": "feedback_loop"` ([A complaint after delivery](delivery-status.md#a-complaint-after-delivery)). ```json { "type": "email.bounced.v1", "timestamp": "2026-10-03T14:07:45.102+00:00", "data": { "emailId": "0199a7c4-5a1e-7d2b-9c41-6f3e0b8a2d17", "projectId": "0199a1b2-0000-7000-8000-000000000001", "to": "ada.lovelace@example.com", "tag": "sign-in", "test": false, "event": "bounced", "occurredAt": "2026-10-03T14:07:45.102+00:00", "attempt": 1, "smtpCode": 550, "enhancedCode": "5.1.1", "classification": "InvalidRecipient", "reason": "recipient_rejected", "response": "550 5.1.1 The email account that you tried to reach does not exist", "remoteHost": "mx.example.com" } } ``` `webhook.test.v1` has `data.endpointId`, `data.projectId` and `data.test` only. ### Inbound mail: `inbound.received.v1` Inbound mail is in an invite-only preview. A message that arrives at an address of one of your receiving domains is taken only when an inbound route matches the address: an exact address (`support`), else the longest prefix (`reply+` matches `reply+4821@…`), else the domain's catch-all, which is off until you make one. Any other address is refused while the sender is still connected (`550 5.1.1`), and a paused route asks the sender to try later (`450 4.2.1`): Postilio never sends a bounce of its own afterwards. A route delivers to one endpoint of its project, in the same mode (a test route to a test endpoint), that has `inbound` among its `events`; the event is not in a new endpoint's default selection; a route made through the API turns it on. Mail is always real; the mode only separates the streams. Set up receiving domains and routes, and fetch or redeliver received messages, as in [Inbound mail](inbound.md). Each route can hold mail back after the message is read: senders it does not allow (`senderAllow`: addresses or `@domain`, matched on the `From` header), mail that fails DMARC (`requireDmarc`), and mail rspamd would reject (`spamAction: "filter_reject"`, the default; `"deliver_all"` sends everything with its score). Held-back mail gets no webhook and does not count in your monthly volume. ```json { "type": "inbound.received.v1", "timestamp": "2026-10-21T13:52:50.102+00:00", "data": { "inboundId": "01a1527c-8e14-7b2a-9c51-3f0e2d6a4b10", "projectId": "0199a1b2-0000-7000-8000-000000000001", "routeId": "01a15270-3c4d-7e5f-8a6b-7c8d9e0f1a2b", "test": false, "receivedAt": "2026-10-21T13:52:48.611+00:00", "envelope": { "mailFrom": "marie@example.org", "recipients": ["support@inbound.northwind-labs.eu"], "remoteIp": "209.85.220.41", "helo": "mail-sor-f41.google.com", "tls": "TLSv1.3" }, "from": { "name": "Marie Curie", "address": "marie@example.org" }, "to": [{ "name": "Northwind support", "address": "support@inbound.northwind-labs.eu" }], "cc": [], "replyTo": [], "subject": "Re: Your order 4821", "date": "2026-10-21T15:52:41+02:00", "messageId": "", "inReplyTo": "<01a14f7e2b6d7c119a3e5d0c8e1f4a27@northwind-labs.eu>", "references": ["<01a14f7e2b6d7c119a3e5d0c8e1f4a27@northwind-labs.eu>"], "related": { "emailId": "01a14f7e-2b6d-7c11-9a3e-5d0c8e1f4a27", "match": "in_reply_to" }, "text": "Hi, the parcel arrived damaged…", "textTruncated": false, "textFromHtml": false, "html": "
Hi, the parcel arrived damaged…
", "htmlTruncated": false, "headers": [{ "name": "Received", "value": "from mail-sor-f41.google.com …" }], "attachments": [{ "index": 0, "filename": "photo.jpg", "contentType": "image/jpeg", "size": 482113, "sha256": "9f2c…", "disposition": "attachment", "contentId": null, "risk": "none", "url": "https://api.postilio.eu/v1/inbound/messages/01a1527c-8e14-7b2a-9c51-3f0e2d6a4b10/attachments/0" }], "auth": { "spf": { "result": "pass", "domain": "example.org" }, "dkim": [{ "result": "pass", "domain": "example.org", "selector": "s1", "aligned": true }], "dmarc": { "result": "pass", "policy": "none", "aligned": true }, "arc": null }, "spam": { "score": 1.2, "verdict": "clean", "symbols": ["MIME_GOOD"] }, "parseError": null, "parseWarnings": [], "contentExpiresAt": "2026-10-25T13:52:48.611+00:00" } } ``` - **Fields are always there**, also when empty (`null`, `[]`), unlike the email events. - **`webhook-id`** is the `inboundId`: every attempt, retry and replay of the message has it. - **Content:** `text` and `html` are each cut at 256 KiB (`textTruncated`, `htmlTruncated`); the whole body stays under 1 MiB. `textFromHtml` says the text was taken from the html because there was no plain part. Attachments are never in the body, only their metadata; `url` fetches one with an API key. `risk` is `executable`, `macro`, `archive` or `none`, from the file name and its first bytes; nothing is scanned for viruses. - **`headers`** are every header in order, decoded; `subject`, `from` and the rest are read from them. - **`related`** names an email your project sent when this message replies to it: by `In-Reply-To` (`"match": "in_reply_to"`), else by the last of `References` (`"references"`); `null` otherwise. Headers can be made up, so treat it as a hint, not proof. - **`auth`** is what Postilio's checks found: SPF of the envelope sender, every DKIM signature (`aligned`: it passed for the `From` domain or a parent or child of it), DMARC of the `From` domain, and ARC when the message has a seal. Results are `pass`, `fail`, `softfail`, `neutral`, `none`, `temperror` or `permerror`. **Trust `from` only with `auth.dmarc.result` `pass`.** An ARC `pass` does not turn a DMARC `fail` into a pass. - **`spam.verdict`** is `clean`, `suspect` (rspamd would mark it) or `spam` (rspamd would reject it), with the score and up to ten of the rules that weighed most; `unscored` when the check did not answer: the message is never held up for it. - **`parseError`** is set when the message could not be read within the limits: a header section over 256 KiB or one header over 16 KiB (`headers_too_large`), more than 100 MIME parts (`too_many_parts`), no readable message (`unreadable`), reading took over 10 seconds (`parse_timeout`), or reading failed three times (`parse_failed`). Then only the envelope and what could be read are there. `parseWarnings` has `charset_unknown` for text in a character set nobody knows, read as Latin-1. - **`contentExpiresAt`:** the content is kept 24 hours after the message was delivered, and 4 days after it arrived at the latest. A delivery whose content went before its turn fails with `content_expired`, and nothing is sent. Until then `GET /v1/inbound/messages/{id}` has the same data, `…/raw` the whole message and `POST …/redeliver` sends the event again; afterwards they answer `410` with `inbound_content_deleted` ([Inbound mail](inbound.md#content-is-kept-briefly)). **Inbound mail is untrusted input.** Anyone can write to an address that takes mail, and the html is exactly what a browser would run, also after a character set like UTF-7 is decoded. Never show the html without sanitizing it. If an AI model reads inbound mail, give it `text` only, mark it as data from a stranger, never let it act on instructions in it without a person confirming, and check `auth` first. ## Delivery - **At least once, in no particular order.** The same event can arrive twice (a retry after an answer that got lost), and the events of one email can arrive out of order: a `delivered` can arrive before its `queued`. A delivery that fails waits for its retry while the endpoint's newer events go ahead, so after a failed `accepted` its `delivered` can arrive first. That is on purpose: one event your endpoint keeps refusing never holds up the others. Every event has one `webhook-id`, the same in every attempt, retry and replay: store the ids you handled and drop repeats. To keep the latest status of an email, compare `data.occurredAt` and ignore an event older than the one you already have. - **Success** is any 2xx answer within **10 seconds**. Answer first, then do the work. Redirects are not followed and count as a failure; register the final URL. Postilio reads at most the first kilobyte of your answer. - **One request at a time** per endpoint. Endpoints are served in turn, a few seconds each, so a slow endpoint mostly slows its own deliveries; many slow endpoints at once delay the others too. - **Retries** after a failure: 30 seconds, then doubling each time (1, 2, 4 … minutes) up to 6 hours between attempts, with some random spread, for **3 days** after the event. That is about 20 attempts; a delivery that has not succeeded by then is `failed` after its next attempt. After a failure the endpoint also rests for 30 seconds before its next delivery. - **Paused after 3 days of failures.** When every attempt to an endpoint failed for 3 days, Postilio pauses it and mails the organization's owners. A paused endpoint gets no new events (they stay in the message log); resume it on the dashboard or with `PATCH {"paused": false}`, and retry failed deliveries from the log. - **Replaying deliveries.** In the portal, each delivery in an endpoint's log has **Retry now** (failed) or **Replay** (delivered), and **Retry failed…** gives every failed delivery of a period one more attempt at once, up to 1,000 per go, the oldest first. The API retries one at a time (`POST /v1/webhooks/{id}/deliveries/{deliveryId}/retry`). A retry or replay sends the same `webhook-id` and body; only `webhook-timestamp` and the signature are new, so the five-minute check keeps working. One that fails again stays `failed`. Events from while the endpoint was paused were never queued, so no retry brings them back. Retries by hand are in the organization's audit log. - **IP addresses.** Deliveries come from Postilio's servers in the EU. There is no fixed, published IP range yet, so do not allow them by IP address: verify the signature. - Requests carry `User-Agent: Postilio-Webhooks/1.0`, `Content-Type: application/json` and no cookies or credentials. ## Verifying the signature Every request has three headers: | Header | Content | |---|---| | `webhook-id` | the event id: drop repeats by it | | `webhook-timestamp` | when it was sent, in Unix seconds | | `webhook-signature` | `v1,` and the base64 of HMAC-SHA256 over `{webhook-id}.{webhook-timestamp}.{body}`, keyed with the base64-decoded part of the secret after `whsec_` | During the 24 hours after a rotation the header holds two signatures separated by a space, one per secret; accept the request when either matches. Refuse a timestamp more than five minutes off, so a captured request cannot be replayed later. Verify the raw body, before parsing it: re-serialized JSON is not byte for byte the same. Seal's notification channels to your own endpoint are signed the same way ([Seal](seal.md#notifications-to-your-own-endpoint)). These examples need no packages. Postilio's own tests run them against the Standard Webhooks test vector. ### Node ```js // Verifies a Postilio webhook (the Standard Webhooks scheme) with Node's own crypto; no packages needed. import { createHmac, timingSafeEqual } from 'node:crypto'; const TOLERANCE_SECONDS = 5 * 60; /** * True when one of the signatures matches and the timestamp is less than five minutes off. * `body` is the raw request body as a string: verify before parsing it. */ export function verifyWebhook(secret, { id, timestamp, signature }, body, nowSeconds = Math.floor(Date.now() / 1000)) { const sent = Number(timestamp); if (!Number.isInteger(sent) || Math.abs(nowSeconds - sent) > TOLERANCE_SECONDS) { return false; } const key = Buffer.from(secret.startsWith('whsec_') ? secret.slice(6) : secret, 'base64'); const expected = createHmac('sha256', key).update(`${id}.${timestamp}.${body}`).digest(); // During a secret rotation the header holds two signatures, space-separated. return signature.split(' ').some((part) => { const [version, value] = part.split(',', 2); const given = Buffer.from(value ?? '', 'base64'); return version === 'v1' && given.length === expected.length && timingSafeEqual(given, expected); }); } // Usage: node verify.mjs [now] if (import.meta.url === `file://${process.argv[1]}`) { const [secret, id, timestamp, signature, body, now] = process.argv.slice(2); const ok = verifyWebhook(secret, { id, timestamp, signature }, body, now ? Number(now) : undefined); console.log(ok ? 'valid' : 'invalid'); process.exit(ok ? 0 : 1); } ``` ### Python ```python """Verifies a Postilio webhook (the Standard Webhooks scheme) with the standard library; no packages needed.""" import base64 import hashlib import hmac import sys import time TOLERANCE_SECONDS = 5 * 60 def verify_webhook(secret: str, msg_id: str, timestamp: str, signature: str, body: str, now: int | None = None) -> bool: """True when one of the signatures matches and the timestamp is less than five minutes off. `body` is the raw request body: verify before parsing it. """ now = int(time.time()) if now is None else now if not timestamp.isdigit() or abs(now - int(timestamp)) > TOLERANCE_SECONDS: return False key = base64.b64decode(secret.removeprefix("whsec_")) expected = hmac.new(key, f"{msg_id}.{timestamp}.{body}".encode(), hashlib.sha256).digest() # During a secret rotation the header holds two signatures, space-separated. for part in signature.split(): version, _, value = part.partition(",") try: given = base64.b64decode(value, validate=True) except ValueError: continue if version == "v1" and hmac.compare_digest(given, expected): return True return False # Usage: python3 verify.py [now] if __name__ == "__main__": secret, msg_id, timestamp, signature, body, *rest = sys.argv[1:] ok = verify_webhook(secret, msg_id, timestamp, signature, body, int(rest[0]) if rest else None) print("valid" if ok else "invalid") sys.exit(0 if ok else 1) ``` ### C# ```csharp using System.Security.Cryptography; using System.Text; namespace Postilio.Webhooks; /// /// Verifies a Postilio webhook (the Standard Webhooks scheme). Copy it into your project; it needs no packages. /// public static class WebhookVerifier { private static readonly TimeSpan Tolerance = TimeSpan.FromMinutes(5); /// /// True when one of the signatures in matches and the timestamp is less than /// five minutes off, which turns away a replayed request. Pass the raw body, not a re-serialized one. /// public static bool Verify(string secret, string id, string timestamp, string signatureHeader, string body, DateTimeOffset now) { if (!long.TryParse(timestamp, out var seconds) || (now - DateTimeOffset.FromUnixTimeSeconds(seconds)).Duration() > Tolerance) { return false; } var key = Convert.FromBase64String(secret.StartsWith("whsec_", StringComparison.Ordinal) ? secret[6..] : secret); var expected = HMACSHA256.HashData(key, Encoding.UTF8.GetBytes($"{id}.{timestamp}.{body}")); // During a secret rotation the header holds two signatures, space-separated: "v1, v1,". foreach (var signature in signatureHeader.Split(' ', StringSplitOptions.RemoveEmptyEntries)) { var parts = signature.Split(',', 2); var given = new byte[expected.Length]; if (parts is ["v1", var value] && Convert.TryFromBase64String(value, given, out var length) && length == given.Length && CryptographicOperations.FixedTimeEquals(given, expected)) { return true; } } return false; } } ``` For example in ASP.NET Core: ```csharp app.MapPost("/hooks/postilio", async (HttpRequest request) => { using var reader = new StreamReader(request.Body); var body = await reader.ReadToEndAsync(); var h = request.Headers; if (!WebhookVerifier.Verify(secret, h["webhook-id"].ToString(), h["webhook-timestamp"].ToString(), h["webhook-signature"].ToString(), body, DateTimeOffset.UtcNow)) { return Results.Unauthorized(); } // Queue the work, drop it when webhook-id was seen before, and answer at once. return Results.NoContent(); }); ``` Source: https://docs.postilio.eu/inbound.md # Inbound mail Inbound mail is in an invite-only preview: the endpoints below answer `403` with `{"error": "inbound_not_in_plan"}` until your organization takes part, and on a plan without inbound mail (Free, or while your organization is in the sandbox). Received mail counts towards your plan's monthly volume like a sent message, see [Usage](usage.md). Postilio can receive mail for you. Point the MX record of a receiving domain at Postilio, add a route for the addresses that should take mail, and every message that arrives comes to your webhook endpoint as an [`inbound.received.v1` event](webhooks.md#inbound-mail-inbound-received-v1): parsed, with its authentication results and spam score. You can also fetch it through the API while its content is kept. Reading needs the `inbound:read` scope (a test key can have it); everything that changes something needs `inbound:manage`, which includes reading. ## Receiving domains A receiving domain is a name your project takes mail on, best a subdomain that receives no mail today (`inbound.example.com`, `reply.example.com`). It is proven by a verified sending domain of the project at or above it, or by a TXT record with a token: the answer's `records` lists what to add at your DNS provider, the TXT token when it needs one and the MX record. Postilio's MX has more than one name: an MX record at an older one (`inbound.postilio.eu`) keeps working, and the MX record then carries `newValue` with today's name once Postilio recommends the move ([Migrate your domain](migrate-domain.md)). ```sh curl https://api.postilio.eu/v1/inbound/domains \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "inbound.example.com" }' ``` A name that already has MX records of another party answers `409` with `{"error": "inbound_domain_has_mx"}` and the hosts in `message`: mail to it would stop arriving there. Send `"confirmExistingMx": true` to go ahead anyway. | Status | Error | When | |---|---|---| | `409` | `inbound_domain_exists` | the project has the name already | | `409` | `inbound_domain_taken` | another project holds the name | | `409` | `inbound_domain_limit_reached` | your organization has the receiving domains its plan allows (5 by default), or the project has 20 | | `422` | `inbound_domain_reserved` | a name of Postilio's own | Postilio checks the DNS of every domain regularly; `POST /v1/inbound/domains/{id}/check` checks one now, at most once a minute (`429` with `Retry-After`). `GET /v1/inbound/domains` lists them, `GET /v1/inbound/domains/{id}` gets one, and `DELETE /v1/inbound/domains/{id}` removes one: mail to it is refused from then on. | Status | Meaning | |---|---| | `pending` | waiting for its proof or its MX record | | `active` | takes mail | | `failing` | its MX record or proof went missing; it still takes mail for a while | | `suspended` | its proof was gone too long; mail is refused | ## Routes A route says which addresses of a receiving domain take mail and where it goes. An address without a route is refused while the sender is still connected (`550 5.1.1`); Postilio never sends a bounce of its own afterwards. ```sh curl https://api.postilio.eu/v1/inbound/routes \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "domainId": "01a15270-3c4d-7e5f-8a6b-7c8d9e0f1a2b", "match": "exact", "value": "support", "action": "webhook", "endpointId": "01a0f3c2-77aa-7c1e-9d2f-0b1c2d3e4f50" }' ``` - **`match`** is `exact` (the local part `value`, so `support` takes `support@…`), `prefix` (every local part that starts with `value`: `reply+` takes `reply+4821@…`) or `catch_all` (every other address, `value` empty). An exact route wins over a prefix, the longest prefix over a shorter one, a prefix over the catch-all. A domain has no catch-all until you make one; it also takes every guess a spammer makes, and each message counts in your monthly volume. - **`action`** is `webhook` (deliver to `endpointId`, an endpoint of the project in the same mode as the route; the route turns the `inbound` event on there) or `store` (keep it for the API only, until its content goes). - **`mode`** is `live` (the default) or `test`: a test route delivers to a test endpoint. Mail is always real; the mode separates the streams, and a test key sees only the mail of test routes. - **`spamAction`** is `filter_reject` (the default: hold back what rspamd would reject) or `deliver_all`. - **`senderAllow`** takes mail only from these senders, addresses or `@domain`, at most 100, matched on the `From` header; **`requireDmarc`** only mail that passes DMARC. Held-back mail (status `filtered`) gets no webhook and does not count in your monthly volume. | Status | Error | When | |---|---|---| | `409` | `inbound_route_exists` | the domain has a route for this pattern already | | `409` | `inbound_route_limit_reached` | the project has 100 routes | | `422` | `inbound_domain_not_found` | `domainId` is not a receiving domain of the project | | `422` | `webhook_endpoint_not_found` | `endpointId` is not a webhook endpoint of the project | | `422` | `webhook_endpoint_mode_mismatch` | the endpoint is a test endpoint and the route a live one, or the other way round | `PATCH /v1/inbound/routes/{id}` changes only the fields you send: `action`, `endpointId`, `spamAction`, `senderAllow`, `requireDmarc`, `description`, and `paused`. A paused route asks senders to try again later (`450 4.2.1`), so nothing is lost while you fix your endpoint. The domain, `match`, `value` and `mode` stay; make a new route to change them. ```sh curl -X PATCH https://api.postilio.eu/v1/inbound/routes/$ROUTE_ID \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "paused": true }' ``` `GET /v1/inbound/routes` lists the project's routes, `GET /v1/inbound/routes/{id}` gets one and `DELETE /v1/inbound/routes/{id}` removes one. ## Received messages ```sh curl "https://api.postilio.eu/v1/inbound/messages?status=failed&limit=20" \ -H "Authorization: Bearer $POSTILIO_KEY" ``` `GET /v1/inbound/messages` lists the newest first, with what is known about each message but never its content: the envelope, `from`, `subject` (only when the project keeps subjects), `messageId`, `inReplyTo`, `relatedEmailId`, the size, the number of attachments, the spam score and verdict, the DMARC result, the status and when the content goes. Filter with `status` and `route` (a route id); for the next page pass the answer's `next` as `before`. | Status | Meaning | |---|---| | `received` | arrived, not read yet | | `delivering` | its webhook is on its way | | `delivered` | your endpoint took it | | `failed` | your endpoint did not take it within the retries, or its content went first | | `stored` | kept for the API: a store route, or a route without a working endpoint | | `filtered` | held back by its route (`filteredReason`: `sender_not_allowed`, `dmarc_failed` or `spam`) | | `expired` | its content went before anything was done with it (`expiredReason`: `content_expired` or `lost_in_restore`) | `GET /v1/inbound/messages/{id}` adds `content`: the `data` of its `inbound.received.v1` event, the same JSON your endpoint got (also for a message that was held back or stored). Once the content went, `content` is `null` and `contentDeleted` is `true`; the rest stays as long as the project keeps its log. ```sh curl https://api.postilio.eu/v1/inbound/messages/$INBOUND_ID/attachments/0 \ -H "Authorization: Bearer $POSTILIO_KEY" -o photo.jpg ``` `GET /v1/inbound/messages/{id}/attachments/{index}` downloads one attachment by its `index`, always as a download (`Content-Disposition: attachment`, `X-Content-Type-Options: nosniff`): never open one in a browser as it comes. Nothing is scanned for viruses. `GET /v1/inbound/messages/{id}/raw` downloads the message exactly as it arrived (`message/rfc822`), also when `text` or `html` in the event were cut. ### Redeliver ```sh curl -X POST https://api.postilio.eu/v1/inbound/messages/$INBOUND_ID/redeliver \ -H "Authorization: Bearer $POSTILIO_KEY" ``` Sends the event once more, now, to the endpoint the message's route has today, with the same `webhook-id` and the same body: your receiver may drop it as a repeat, so drop it only once you stored the first one. It is one attempt, without retries. `409` with `delivery_still_pending` while a delivery to that endpoint is still being tried, `endpoint_paused` while the endpoint is paused, and `inbound_route_has_no_endpoint` when the route stores mail, has no endpoint any more or was deleted, or the endpoint does not take `inbound` events. ### Content is kept briefly The content of a message (its parsed form, attachments and raw mail) is kept 24 hours after it was delivered, and 4 days after it arrived at the latest; a held-back message 24 hours. `contentExpiresAt` says when. After that, the attachment, raw and redeliver endpoints answer `410` with `{"error": "inbound_content_deleted"}`, and a delivery still waiting for its turn fails with `content_expired` without sending anything. Download what you need when the event arrives. `DELETE /v1/inbound/messages/{id}/content` deletes the content now; the metadata stays. A message that was not delivered yet becomes `expired`. Deleting content that is gone already answers `204` too. ```sh curl -X DELETE https://api.postilio.eu/v1/inbound/messages/$INBOUND_ID/content \ -H "Authorization: Bearer $POSTILIO_KEY" ``` Downloading an attachment or the raw message, redelivering and deleting content are in your organization's audit log, with the API key as the actor; the content itself never is. ## Receive the event A receiver checks the signature over the raw body, drops a repeat by its `webhook-id` (the `inboundId`), answers `2xx` quickly, and fetches the attachments it needs with an API key while they are kept. An attachment that answers `410` is gone: log it and carry on, never retry it. Each example below uses the verifier from [Verifying the signature](webhooks.md#verifying-the-signature) next to it, and keeps the ids it saw in memory; keep them in your database instead, so a restart does not forget them. Inbound mail is untrusted input: never show its html without sanitizing it, and trust `from` only with `auth.dmarc.result` `pass`. ### Node ```js // Receives inbound mail from Postilio: checks the signature, drops a repeat, answers at once, then fetches the // attachments with an API key. Node 22, no packages. Run: PORT=3000 node inbound-receiver.mjs import { createServer } from 'node:http'; import { verifyWebhook } from './verify.mjs'; const secret = process.env.POSTILIO_WEBHOOK_SECRET; const apiKey = process.env.POSTILIO_KEY; const seen = new Set(); // the webhook-ids taken; keep them in your database createServer((req, res) => { const chunks = []; req.on('data', (chunk) => chunks.push(chunk)); req.on('end', () => { const body = Buffer.concat(chunks).toString('utf8'); const id = req.headers['webhook-id'] ?? ''; const signed = { id, timestamp: req.headers['webhook-timestamp'] ?? '', signature: req.headers['webhook-signature'] ?? '' }; if (!verifyWebhook(secret, signed, body)) { res.writeHead(401).end(); return; } if (seen.has(id)) { console.log(`repeat ${id}`); res.writeHead(204).end(); return; } const event = JSON.parse(body); seen.add(id); // store the event itself here too, before answering res.writeHead(204).end(); if (event.type === 'inbound.received.v1') { handleMail(event.data).catch((error) => console.error(error)); } }); }).listen(Number(process.env.PORT ?? 3000)); async function handleMail(mail) { // Trust the sender only when DMARC passed; treat the text and html as untrusted input. console.log(`mail ${mail.inboundId} from ${mail.from?.address} (dmarc ${mail.auth?.dmarc?.result ?? 'none'})`); for (const attachment of mail.attachments) { const response = await fetch(attachment.url, { headers: { Authorization: `Bearer ${apiKey}` } }); if (response.status === 410) { console.log(`attachment ${attachment.index} gone`); // the content expired: never retry it continue; } if (!response.ok) { throw new Error(`attachment ${attachment.index}: ${response.status}`); } const bytes = Buffer.from(await response.arrayBuffer()); console.log(`attachment ${attachment.index} ${attachment.filename} ${bytes.length} bytes`); } } ``` ### Python ```python """Receives inbound mail from Postilio: checks the signature, drops a repeat, answers at once, then fetches the attachments with an API key. Standard library only. Run: PORT=3000 python3 inbound_receiver.py""" import json import os import threading import urllib.error import urllib.request from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from verify import verify_webhook SECRET = os.environ["POSTILIO_WEBHOOK_SECRET"] API_KEY = os.environ["POSTILIO_KEY"] seen = set() # the webhook-ids taken; keep them in your database def handle_mail(mail): # Trust the sender only when DMARC passed; treat the text and html as untrusted input. dmarc = (mail.get("auth", {}).get("dmarc") or {}).get("result", "none") print(f"mail {mail['inboundId']} from {(mail.get('from') or {}).get('address')} (dmarc {dmarc})", flush=True) for attachment in mail["attachments"]: request = urllib.request.Request(attachment["url"], headers={"Authorization": f"Bearer {API_KEY}"}) try: with urllib.request.urlopen(request, timeout=30) as response: content = response.read() except urllib.error.HTTPError as e: if e.code == 410: print(f"attachment {attachment['index']} gone", flush=True) # the content expired: never retry it continue raise print(f"attachment {attachment['index']} {attachment['filename']} {len(content)} bytes", flush=True) class Receiver(BaseHTTPRequestHandler): def do_POST(self): body = self.rfile.read(int(self.headers.get("Content-Length", 0))).decode() msg_id = self.headers.get("webhook-id", "") if not verify_webhook(SECRET, msg_id, self.headers.get("webhook-timestamp", ""), self.headers.get("webhook-signature", ""), body): self.send_response(401) self.end_headers() return if msg_id in seen: print(f"repeat {msg_id}", flush=True) else: event = json.loads(body) seen.add(msg_id) # store the event itself here too, before answering if event["type"] == "inbound.received.v1": threading.Thread(target=handle_mail, args=(event["data"],)).start() self.send_response(204) self.end_headers() ThreadingHTTPServer(("", int(os.environ.get("PORT", "3000"))), Receiver).serve_forever() ``` ### C# ```csharp using System.Collections.Concurrent; using System.Net; using System.Net.Http.Headers; using System.Text.Json; using System.Threading.Channels; namespace Postilio.Webhooks; /// /// Receives inbound mail from Postilio: checks the signature, drops a repeat, answers at once and queues the mail; a /// background loop () fetches the attachments with an API key. Uses WebhookVerifier, no packages. /// In a minimal API: app.MapPost("/postilio/inbound", async (HttpRequest r) => Results.StatusCode(receiver.Receive( /// r.Headers["webhook-id"]!, r.Headers["webhook-timestamp"]!, r.Headers["webhook-signature"]!, await new StreamReader(r.Body).ReadToEndAsync()))). /// public sealed class InboundReceiver(string secret, string apiKey, HttpClient http, Action log) { private readonly ConcurrentDictionary _seen = new(); // the webhook-ids taken; keep them in your database private readonly Channel _mail = Channel.CreateUnbounded(); /// The status code to answer: 401 for a wrong signature, else 204 at once. public int Receive(string id, string timestamp, string signature, string body) { if (!WebhookVerifier.Verify(secret, id, timestamp, signature, body, DateTimeOffset.UtcNow)) { return 401; } if (!_seen.TryAdd(id, true)) { log($"repeat {id}"); return 204; } // Store the event itself here too, before answering. using var json = JsonDocument.Parse(body); if (json.RootElement.GetProperty("type").GetString() == "inbound.received.v1") { _mail.Writer.TryWrite(json.RootElement.GetProperty("data").Clone()); } return 204; } /// Handles the queued mail until stops it; run it as a background service. public async Task RunAsync(CancellationToken ct) { while (await _mail.Reader.WaitToReadAsync(ct)) { await ProcessPendingAsync(ct); } } public async Task ProcessPendingAsync(CancellationToken ct) { while (_mail.Reader.TryRead(out var mail)) { await HandleMailAsync(mail, ct); } } private async Task HandleMailAsync(JsonElement mail, CancellationToken ct) { // Trust the sender only when DMARC passed; treat the text and html as untrusted input. var dmarc = mail.GetProperty("auth").TryGetProperty("dmarc", out var d) && d.ValueKind == JsonValueKind.Object ? d.GetProperty("result").GetString() : "none"; log($"mail {mail.GetProperty("inboundId").GetString()} from {mail.GetProperty("from").GetProperty("address").GetString()} (dmarc {dmarc})"); foreach (var attachment in mail.GetProperty("attachments").EnumerateArray()) { var index = attachment.GetProperty("index").GetInt32(); using var request = new HttpRequestMessage(HttpMethod.Get, attachment.GetProperty("url").GetString()); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", apiKey); using var response = await http.SendAsync(request, ct); if (response.StatusCode == HttpStatusCode.Gone) { log($"attachment {index} gone"); // the content expired: never retry it continue; } response.EnsureSuccessStatusCode(); var bytes = await response.Content.ReadAsByteArrayAsync(ct); log($"attachment {index} {attachment.GetProperty("filename").GetString()} {bytes.Length} bytes"); } } } ``` Source: https://docs.postilio.eu/errors.md # Errors and limits The API answers with the usual HTTP status codes. An error has a JSON body that says why, with two exceptions: a `404` has no body, and neither has a `400` for a body that is not JSON or has a field of the wrong type (a string where a list belongs, say). A method or a content type that a path does not take answers `404` too; send JSON with `Content-Type: application/json`. ## Status codes | Status | Body | When | |---|---|---| | `200`, `201`, `202`, `204` | the result (none for `204`) | success; `202` means accepted, the work happens afterwards | | `400` | validation problem | a field is not valid; the body lists the fields | | `401` | `{"error": "invalid_api_key"}` | no key, or a key that does not exist or was revoked | | `403` | `{"error": "…"}` | `insufficient_scope`, `client_ip_not_allowed`, `organization_suspended` or `project_suspended`, see [Authentication](authentication.md#errors) | | `404` | none | no such resource **in this key's project and mode**, or no such path | | `409` | `{"error": "…"}` | conflicts with what is there, see the codes below | | `413` | `{"error": "…", "message": "…"}` | too large: the message, its size times its recipients, or the request body; the `message` names the limit, see [Message size](#message-size) | | `422` | `{"error": "…"}` | valid, but cannot be done now, see the codes below | | `429` | `{"error": "…"}` | a limit; wait as long as the `Retry-After` header says (in seconds) | | `500` | problem with a `traceId` | an error at Postilio; quote the `traceId` when you contact support | | `503` | `{"error": "…"}` | `service_degraded` when sending: Postilio takes no new messages for now, wait as long as `Retry-After` says; or `dns_unavailable` from a domain check | ### Validation problems A `400` is `application/problem+json` with the problems per field: ```json { "type": "https://tools.ietf.org/html/rfc9110#section-15.5.1", "title": "One or more validation errors occurred.", "status": 400, "errors": { "to": ["Between 1 and 50 recipients are required."], "body": ["Either text or html is required."] }, "traceId": "00-4d6a1c9b71484cc59ac852cda603b93c-28de36d1c118bc08-00" } ``` The keys of `errors` are the request's field names; `body` stands for `text` and `html` together, and `idempotencyKey` for the `Idempotency-Key` header. Fix the request before you send it again: the same request gets the same answer. ### 404, never 403, for what is not yours A resource of another project answers `404`, just like one that does not exist, so ids cannot be probed. The same goes for the other mode: a test key does not find live messages, and a live key does not find test messages. ## Error codes | Status | `error` | Meaning | |---|---|---| | `401` | `invalid_api_key` | the key is missing, unknown or revoked | | `403` | `insufficient_scope` | the key lacks the scope of this call | | `403` | `client_ip_not_allowed` | the key may not be used from this address | | `403` | `organization_suspended` | Postilio suspended your organization: no project sends until it is resumed | | `403` | `project_suspended` | the key's project is paused or suspended; your other projects keep sending | | `403` | `inbound_not_in_plan` | inbound mail is not available to your organization, see [Inbound mail](inbound.md) | | `409` | `idempotency_key_reused_with_different_request` | the `Idempotency-Key` was used for another request in the last 24 hours | | `409` | `domain_exists` | the project has this domain already | | `409` | `address_already_suppressed` | the address is on the suppression list already | | `413` | `message_too_large` | the message is over 10 MB, see [Message size](#message-size) | | `413` | `message_too_large_for_recipients` | the message's size times its recipients is over 25 MB; send to fewer recipients at a time | | `413` | `payload_too_large` | the request body is over what the endpoint reads (21 MB for sending, 1 MB elsewhere); it is not read further | | `409` | `domain_limit_reached` | your plan allows no more domains, see [Plan limits](#plan-limits) | | `409` | `webhook_endpoint_limit_reached` | the project has 10 webhook endpoints, or your plan allows no more | | `409` | `delivery_still_pending` | the delivery is still being retried | | `409` | `email_not_scheduled` | the message is not waiting for its `sendAt` (any more): it was not scheduled, was canceled, or is on its way | | `409` | `scheduled_limit_reached` | the project holds 10,000 scheduled messages, see [Scheduled sending](sending.md#scheduled-sending) | | `409` | `scheduled_size_limit_reached` | the project's scheduled messages would hold more than 256 MB together | | `409` | `endpoint_paused` | resume the webhook endpoint first | | `409` | `inbound_domain_exists`, `inbound_domain_taken`, `inbound_domain_has_mx`, `inbound_domain_limit_reached` | adding a receiving domain, see [Inbound mail](inbound.md#receiving-domains) | | `409` | `inbound_route_exists`, `inbound_route_limit_reached` | adding an inbound route, see [Routes](inbound.md#routes) | | `409` | `inbound_route_has_no_endpoint`, `inbound_still_processing` | redelivering a received message, see [Redeliver](inbound.md#redeliver) | | `410` | `inbound_content_deleted` | the received message's content went, see [Content is kept briefly](inbound.md#content-is-kept-briefly) | | `422` | `unverified_sender_domain` | the sender's domain is not verified, or has been failing for over 72 hours | | `422` | `sender_domain_not_allowed_for_key` | the key is restricted to other sending domains | | `422` | `sandbox_recipient_not_allowed` | in the sandbox: a recipient outside your team and verified domains | | `422` | `send_at_too_soon` | `sendAt` is less than a minute ahead, or in the past | | `422` | `send_at_too_far` | `sendAt` is more than 30 days ahead | | `422` | `attachment_type_not_allowed` | an attachment is an executable file, such as `.exe` or `.js`; the message names it, see [Attachments](sending.md#attachments) | | `422` | `cc_bcc_require_single_to` | `cc` or `bcc` with more than one address in `to`, see [Cc and Bcc](sending.md#cc-and-bcc) | | `422` | `inbound_domain_reserved`, `inbound_domain_not_found`, `webhook_endpoint_not_found`, `webhook_endpoint_mode_mismatch` | see [Inbound mail](inbound.md) | | `422` | `reason_required` | removing a complaint from the suppression list needs a reason | | `422` | `test_recipient_not_confirmed` | a test email to an address that is neither confirmed for test emails nor a member's, see [Test emails](test-emails.md) | | `429` | `sandbox_daily_limit_reached` | in the sandbox: the day's recipients are used up | | `429` | `sandbox_rate_limit_reached` | in the sandbox: this minute's recipients are used up | | `429` | `probation_daily_limit_reached` | in the first weeks after the sandbox: the day's recipients are used up, see [Probation](#probation-after-the-sandbox) | | `429` | `probation_rate_limit_reached` | in the first weeks after the sandbox: this minute's recipients are used up | | `429` | `project_daily_limit_reached` | the project's own limit: the day's recipients are used up | | `429` | `project_rate_limit_reached` | the project's own limit: this minute's recipients are used up | | `429` | `plan_monthly_limit_reached` | your plan's month is used up, see [Plan limits](#plan-limits) | | `429` | `plan_daily_limit_reached` | your plan's day is used up | | `429` | `plan_rate_limit_reached` | your plan's minute is used up | | `429` | `platform_rate_limit_reached` | the platform's safety limit per key or project, or on a project's test keys: this minute's recipients are used up, see [Platform limits](#platform-limits) | | `429` | `platform_daily_limit_reached` | the platform's safety limit per project, or on its test keys: the day's recipients are used up | | `429` | `test_mail_daily_limit_reached` | the project's test emails for the day (UTC) are used up | | `429` | `too_many_checks` | a domain can be checked once a minute | | `503` | `service_degraded` | Postilio takes no new messages for now, to protect its storage; nothing was stored, so send it again after `Retry-After` | | `503` | `dns_unavailable` | the domain check got no answer from DNS | Handle a code you do not know by its status code. ## The sandbox A new organization starts in the sandbox. By default its **live** mail: - goes only to the organization's active members and to addresses on the verified domains of its projects. A message with any other recipient answers `422 sandbox_recipient_not_allowed`, and nothing of it is sent; - is limited to **100 recipients per day** (UTC) and **10 recipients per minute**, for the whole organization, through the API and SMTP together. Over a limit the answer is `429` with `sandbox_daily_limit_reached` or `sandbox_rate_limit_reached`, and a `Retry-After` until the next UTC day or minute. A message that is refused uses up nothing, and a suppressed recipient doesn't count. Your plan's own limits apply in the sandbox too; the lower of the two counts, and names the error: `sandbox_…` when the sandbox's limit is as low as the plan's or lower, `plan_…` when the plan's is lower. Test keys are never limited by the sandbox. The **Sandbox** page in the portal shows your organization's limits, the day's usage and how to ask for full access, which lifts them. ## Probation after the sandbox Full access starts with four weeks of probation. Your **live** mail goes to any address, but the whole organization sends under a cap that rises each week, counted from the day you got full access: | Week | Recipients per day (UTC) | Recipients per minute | |---|---|---| | 1 | 1,000 | 60 | | 2 | 5,000 | 200 | | 3 and 4 | 20,000 | 500 | After that only your plan's limits apply. The cap is counted as the sandbox's is: live recipients that aren't suppressed, through the API and SMTP together; a refused message uses up nothing. Over it the answer is `429` with `probation_daily_limit_reached` or `probation_rate_limit_reached`, and a `Retry-After` until the next UTC day or minute; over SMTP the reply is `451 4.7.1`, so a mail server tries again later. ```json { "error": "probation_daily_limit_reached" } ``` Your plan's limits apply too; the lower of the two counts and names the error: `probation_…` when the cap is as low as the plan's or lower, `plan_…` when the plan's is lower. Test keys are never limited by it. Why: a new sender's mail is new to the mailbox providers too, and they trust an address that starts small and grows steadily. During these weeks Postilio may send your mail from addresses it keeps for new organizations, and it pauses a project sooner than usual when its bounce or complaint rate is high (see [Paused projects](#paused-and-suspended-projects)). The **Sandbox** page in the portal shows the current cap and when the probation ends. If you expect more volume early on, contact support before you start: Postilio can end the probation sooner or extend it. ## Plan limits Your organization's plan limits how many messages it sends per UTC month, per UTC day and per minute, for all its projects together, through the API and SMTP. It counts **live recipients that aren't suppressed** when the message is accepted, which is also what is billed; test keys, repeats with the same `Idempotency-Key` and refused messages count nothing. The **Usage & plan** page in the portal shows where you stand. The limits themselves depend on your organization's plan and can change; this page doesn't list them. The **Usage & plan** page in the portal shows the current values for your organization, or ask support. When a limit is reached: - **The month**: a plan's monthly limit is either hard, and sending stops at the limit, or soft, and sending goes on up to a cap above it and stops there. The answer is `429 plan_monthly_limit_reached` with a `Retry-After` until the 1st of the next month, 00:00 UTC. - **The day and the minute** always stop at the limit: `429 plan_daily_limit_reached` until 00:00 UTC, or `429 plan_rate_limit_reached` until the next minute, with a `Retry-After`. - Over SMTP each of these is `451 4.7.1`, also for the month: a mail server tries again later, and gets through once the limit is raised or the period ends. - **Projects, domains, members, keys and webhook endpoints** are checked when you add one: `409` with `project_limit_reached`, `domain_limit_reached`, `member_limit_reached`, `api_key_limit_reached` or `webhook_endpoint_limit_reached`. Nothing you have is ever removed or switched off when a plan has a lower limit; you can't add more until you are under it. Mail that was accepted is always delivered: the limits apply when a message is accepted, never in the queue. Postilio e-mails the Owners and Billing members when the month reaches 80 % and 100 %, and when sending pauses at the limit or the cap (the Admins too), each once a month. They also get a mail on the first day a daily or per-minute limit refuses mail. Every member sees a banner in the portal from 80 %. A plan that gets stricter starts on the 1st of a month, and a shorter message log only 30 days after the change, so there is time to export. ## Project limits An Owner or Admin can give a project a limit of its own, per day (UTC) and per minute, under Settings → Projects: a brake for when a key leaks or an app misbehaves, so one project can't use up what the organization may send. Over it, a live message answers `429` with `project_daily_limit_reached` or `project_rate_limit_reached` and a `Retry-After` until the next UTC day or minute; over SMTP the reply is `451 4.7.1`, so a mail server tries again later. It counts live recipients that aren't suppressed, through the API and SMTP together; test keys and repeats with the same `Idempotency-Key` don't count, and a refused message uses up nothing. The organization's own limits (the plan's and the sandbox's or probation's) still apply on top, and the first that is reached names the error. ## Platform limits Apart from your plan and your projects' own limits, Postilio limits every API key to 3,000 live recipients a minute and every project to 3,000 a minute and 250,000 a UTC day: a safety brake for a key that leaked or an app stuck in a loop, far above what any plan allows. Over it, a live message answers `429` with `platform_rate_limit_reached` or `platform_daily_limit_reached` and a `Retry-After` until the next minute or UTC day; over SMTP the reply is `451 4.7.1`. It counts as the project limits do: live recipients that aren't suppressed, API and SMTP together. Postilio looks into it well before a project gets there; contact support if you need more. **Test keys** have limits of their own: a project's test keys together may send **3,000 recipients a minute and 100,000 a UTC day**. They answer with the same two codes and a `Retry-After`, over SMTP with `451 4.7.1`. Test and live are counted apart, so a test run never uses up what your live mail may send, nor the other way round. In this limit **every recipient counts**, suppressed ones too (such as `suppressed@simulator.postilio.eu`), because every test message is stored. A refused message and a repeat with the same `Idempotency-Key` don't count. The sandbox's, probation's, project's and plan's limits don't count test keys; the [message size](#message-size) and [SMTP](sending.md#limits-and-replies) limits hold for them as for live keys. ## Paused and suspended projects Sending can stop for one project while the rest of your organization goes on. Its keys then answer `403 project_suspended` (over SMTP `554 5.7.1 project_suspended`), and mail it already accepted waits in the queue: it goes out when the project is resumed within a day, and expires after that. A scheduled message has that day from its `sendAt`. The portal shows a banner on the project with what happened. There are three ways in: - **Pause sending**: an Owner or Admin pauses the project in the portal (Settings → Projects), for example after a key leaked. They resume it there too. - **Paused automatically**: when too many of a project's live messages bounce or get a complaint. Postilio weighs the last 24 hours every 15 minutes: at **10 % bounces** (of at least 100 messages with an outcome) or **0.3 % complaints** (of at least 300 delivered messages, from at least 10 different recipients: see [A complaint after delivery](delivery-status.md#a-complaint-after-delivery)) it pauses the project and mails its Owners and Admins. From 5 % bounces or 0.1 % complaints they get a warning first, at most once a day. Find and fix the cause (an old list, a form bots fill in, a leaked key), then an Owner or Admin resumes it under Settings → Projects with a short note, once every 30 days; after that Postilio reviews it. After a resume only newer messages count. In the [probation](#probation-after-the-sandbox) after the sandbox the pause comes sooner: at **5 % bounces** (of at least 50 messages with an outcome) or **0.3 % complaints** of at least 100 delivered messages from at least **3** different recipients. From 0.1 % complaints Postilio also takes a look itself; that alone doesn't pause anything. - **Suspended by Postilio**: after an abuse report, say. Only Postilio lifts it; the banner says what to do. A suspension of the whole organization comes first: then every key answers `403 organization_suspended`. ## Message size A message is at most **10 MB**: `from`, `replyTo`, `subject`, `tag`, `text` and `html` in UTF-8 bytes, plus each attachment's decoded content (not its base64) with its `fileName`, `contentType` and `contentId`. Over it the answer is `413 message_too_large`. Every recipient gets a copy, so the size **times the recipients** is at most **25 MB**, for example a 1 MB message to 25 recipients; over it the answer is `413 message_too_large_for_recipients`, and you send to fewer recipients at a time. The request body of `POST /v1/emails` is read up to 21 MB (base64 makes attachments a third larger); a larger body is not read and answers `413 payload_too_large`, as does a body over 1 MB on any other endpoint. Each `413` has a `message` that names the limit: ```json { "error": "message_too_large", "message": "A message may be at most 10485760 bytes; this one is 10485761." } ``` Over SMTP the same limits hold, see [SMTP limits](sending.md#limits-and-replies). ## Limits | What | Limit | |---|---| | Recipients per message | 50 | | Message size | 10 MB, attachments included; size times recipients at most 25 MB, see [Message size](#message-size) | | Attachments | 20 | | Subject | 998 characters | | Tag | 64 characters: letters, digits, `-`, `_` | | `Idempotency-Key` | 1 to 256 characters, remembered for 24 hours | | Scheduled sending | `sendAt` a minute to 30 days ahead; 10,000 scheduled messages per project, together 256 MB | | Test emails | 10 a day (UTC) per project, to confirmed addresses and members only, see [Test emails](test-emails.md) | | Sandbox (live mail) | 100 recipients a day, 10 a minute, per organization (by default) | | Your plan | messages a month, a day and a minute, and how many projects, domains, members, keys and webhook endpoints, see [Plan limits](#plan-limits) | | Project limit (optional) | up to 1,000,000 recipients a day and 100,000 a minute, set per project | | Platform limit | 3,000 recipients a minute per key, 3,000 a minute and 250,000 a day per project, see [Platform limits](#platform-limits) | | Test keys | 3,000 recipients a minute and 100,000 a day per project, apart from live mail, see [Platform limits](#platform-limits) | | Domain check on request | once a minute per domain | | Webhook endpoints | 10 per project, and your plan's limit for the organization | | API key restrictions | 20 domains, 20 networks | | List pages (`limit`) | 1 to 100, 50 by default | | Request body | 21 MB for `POST /v1/emails`, 1 MB for every other endpoint | | SMTP | 10 MB per message, 20 messages per connection, 600 messages per key per minute (see [SMTP](sending.md#limits-and-replies)) | Source: https://docs.postilio.eu/idempotency.md # Idempotency A request can time out after Postilio accepted it. Sending it again could deliver the email twice. With an `Idempotency-Key` header you can safely send it again: Postilio recognizes the repeat and answers as it did the first time, without sending anything again. ```sh curl https://api.postilio.eu/v1/emails \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: order-1042-receipt" \ -d '{ "from": "Acme ", "to": ["ada.lovelace@example.com"], "subject": "Your order 1042", "text": "Thank you for your order." }' ``` In Node or C#, add the same header to the request: `'Idempotency-Key': 'order-1042-receipt'` in the `headers` of `fetch`, or `request.Headers.Add("Idempotency-Key", "order-1042-receipt")` on an `HttpRequestMessage`. ## How it works - **The key** is any string of 1 to 256 characters that you choose per email you mean to send once: an order number with the kind of mail, say, or a UUID you store with the job. It is only for `POST /v1/emails`. - **Within 24 hours** of the first request, a request with the same key and the same body answers `202` with the same `ids` and `suppressed` as the first one, and sends nothing. - **The same key with another body** answers `409` with `{"error": "idempotency_key_reused_with_different_request"}`. Any difference in the fields counts, the order of `to` too; the layout of the JSON does not. - **`sendAt` is compared as a moment**, not as text: `2026-11-02T09:00:00+01:00` and `2026-11-02T08:00:00Z` are the same request. A repeat answers as the first did, also when its `sendAt` has come closer than a minute in the meantime. - **Only an accepted request is remembered.** A request that answered `400`, `422` or `429` stored nothing, so you can fix it and send it again with the same key. - **Two at once.** When the same request arrives twice at the same time, the second waits for the first and gets its answer. - **Per project and per mode**: a test key and a live key do not share keys, and neither do two projects. - **A repeat is checked first.** The sender's domain, the key's restrictions and the sandbox's recipients are checked before Postilio looks the key up, so a repeat after the domain was removed answers that error (`422`), not the first answer. Nothing is sent twice either way. - After 24 hours the key is free again and counts as a new request. ## SMTP Over SMTP, the `Message-ID` header is the key. A client that sends a message again after a lost reply, with the same `Message-ID` to the same recipients within 24 hours, gets `250` and the message is not sent twice. The same `Message-ID` with other content is refused with `554 5.6.0 message_id_reused_with_different_content`. A message without a `Message-ID` is sent every time it arrives. Source: https://docs.postilio.eu/suppressions.md # Suppressions and test mode ## The suppression list Every project has a list of addresses Postilio no longer sends to. Mail to them would bounce again or be marked as spam again, and that hurts the delivery of all your other mail. An address gets on the list: | Reason | How | |---|---| | `hard_bounce` | by itself, when a receiving server refuses it for good (a `5xx` answer) because the mailbox or domain does not exist or is no longer in use, during delivery or in a bounce that arrives after it ([A bounce after delivery](delivery-status.md#a-bounce-after-delivery)). A block for spam or policy reasons (`5.7.x`) does not count: that is about reputation, not about the address. | | `complaint` | by itself, when the recipient marks a message as spam and the mailbox provider's feedback loop reports it ([A complaint after delivery](delivery-status.md#a-complaint-after-delivery)) | | `manual` | when you add it, in the portal or with the API | Test messages never put an address on the list. Addresses are compared without regard to case. ### Sending to a suppressed address Postilio accepts the message but does not send it. The `202` answer lists the address in `suppressed`, and its message gets the status `suppressed` with an event that says why. An address that gets on the list after a message to it was accepted, but before it was sent, is not sent to either. ### Manage the list Reading the list needs the `suppressions:read` scope; adding and removing need `suppressions:manage`, which includes reading. ```sh curl "https://api.postilio.eu/v1/suppressions?reason=hard_bounce&limit=20" \ -H "Authorization: Bearer $POSTILIO_KEY" ``` `GET /v1/suppressions` lists the newest first. Filter with `q` (part of an address) and `reason`; for the next page pass the answer's `next` as `before`. To check one address, pass it whole as `address` (any case). The list then holds its entry, with the reason and since when, or is empty when the address is not suppressed: ```sh curl "https://api.postilio.eu/v1/suppressions?address=ada@example.com" \ -H "Authorization: Bearer $POSTILIO_KEY" ``` Add an address by hand with `POST /v1/suppressions`; it gets the reason `manual`. An address that is on the list already answers `409` with `{"error": "address_already_suppressed"}`. ```sh curl https://api.postilio.eu/v1/suppressions \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "address": "former.customer@example.org" }' ``` Remove one with `DELETE /v1/suppressions/{id}`, and Postilio sends to it again. A complaint is only removed with a reason of 10 to 500 characters, which Postilio keeps; without one the answer is `422` with `{"error": "reason_required"}`. Remove a complaint only when the recipient asked for your mail again. ```sh curl -X DELETE https://api.postilio.eu/v1/suppressions/$SUPPRESSION_ID \ -H "Authorization: Bearer $POSTILIO_KEY" \ -H "Content-Type: application/json" \ -d '{ "reason": "The customer subscribed again on 5 October." }' ``` ## Test mode A message sent with a test key (`pk_test_…`) goes through every check a live one does (the sender's domain, the key's restrictions, the suppression list) and is stored, but it is never sent. Instead it gets simulated events at once. The recipient decides the outcome: | Recipient | Outcome | |---|---| | `delivered@simulator.postilio.eu` | `delivered` | | `bounced@simulator.postilio.eu` | `bounced`: `550 5.1.1`, the mailbox does not exist | | `deferred@simulator.postilio.eu` | `deferred`: `451 4.7.1`, greylisted | | `complained@simulator.postilio.eu` | `delivered`, then `complained` | | `suppressed@simulator.postilio.eu` | `suppressed`, as if the address were on the suppression list | | any other address | `delivered` | A tag after a plus keeps test runs apart and changes nothing: `bounced+run-42@simulator.postilio.eu` bounces too. Test messages: - have `"test": true` and are found only with a test key; - reach only webhook endpoints in test mode, with the same events a live message would get; - never count as usage or against the sandbox, and never put an address on the suppression list; - have a volume limit of their own, apart from live mail: 3,000 recipients a minute and 100,000 a day per project, suppressed ones included (see [Platform limits](errors.md#platform-limits)). Use a test key in your own tests and in CI. Switching to live is swapping the key. Source: https://docs.postilio.eu/usage.md # Usage Postilio counts what you send per project and per calendar month in UTC. The month is the period your plan's monthly limit applies to, and the one that will be billed. ## What counts | Number | Meaning | |---|---| | `accepted` | live messages accepted, one per recipient | | `suppressed` | accepted messages that were never sent, because the address is on the suppression list | | `billable` | `accepted` minus `suppressed`: what is billed and what counts towards the monthly limit | | `delivered`, `bounced`, `complained` | what happened in the month, counted on the moment it happened | | `received` | [inbound mail](inbound.md) the project received: one per message, also when it reached several of your routes. A message to receiving domains of two of your projects counts in each project, and once towards your organization's monthly limit. It counts towards the monthly limit like a sent message; mail held back by a route does not. `null` when your organization does not receive inbound mail | A bounce still counts as billable: the message was sent. Messages sent with a test key (`pk_test_…`) never count. A message accepted on the last evening of a month counts in that month, even when it is delivered after midnight. A [scheduled](sending.md#scheduled-sending) message counts when it goes out, not when you scheduled it; one that is canceled never counts. A month is closed a day after it ends. From then on its numbers never change (`final` is `true`), not even when a project is deleted or moved to another organization. Usage before a project moved stays with the organization it was billed to. ## Read the usage of a project `GET /v1/usage` needs a live key with the `usage:read` scope. That scope is never on by default: add it to a key that reads usage, such as one for your own dashboard or billing script. The key sees its own project only. ```sh curl "https://api.postilio.eu/v1/usage?month=2026-10" \ -H "Authorization: Bearer $POSTILIO_KEY" ``` ```json { "month": "2026-10", "final": false, "resetsAt": "2026-11-01T00:00:00+00:00", "organization": { "plan": "growth", "state": "warning" }, "project": { "id": "0199b3c0-6f3a-7d2e-9a41-2c8e5d7f1a20", "billable": 12040, "accepted": 12101, "suppressed": 61, "delivered": 11950, "bounced": 88, "complained": 2, "received": null }, "apiKey": { "id": "0199b3c4-2b71-7c05-8e6d-5a9f3c1e7b42", "accepted": 8020, "sent": 7981, "suppressed": 39, "delivered": 7915, "bounced": 64, "complained": 2 } } ``` `month` is `yyyy-MM`; without it you get the current month. A month without usage answers with zeros. A month in the future, before 2020 or in another format answers `400` with the problem in `errors.month`. `organization` tells where your organization as a whole stands against the monthly limit of its plan, without its numbers or those of its other projects: | `state` | Meaning | |---|---| | `ok` | below 80% of the monthly limit, or no limit | | `warning` | from 80% | | `over` | from 100%, on a plan with overage | | `capped` | at the point where sending stops: 100% on a plan without overage, the overage cap on one with it | | `null` | the month asked for is not the current one | `plan` is the code of the plan the organization has now. `resetsAt` is the start of the next month, when the limit starts over. `apiKey` is the key making the call, and only that key: never the project's other keys. A key moved from another project counts here from the move on; what it sent before stays with that project. Its numbers are informative; the project's are the ones that are billed. They count differently from `project`: | Number | Meaning | |---|---| | `accepted` | messages this key had accepted in the month, over the API and over SMTP | | `sent` | `accepted` minus `suppressed` | | `suppressed` | accepted but never sent, because the address is on the suppression list | | `delivered`, `bounced`, `complained` | the status those messages have now, counted on the day they were accepted | A message accepted on 31 October that bounces on 1 November is a bounce of October here. A complaint after delivery counts as `complained`, not as `delivered`. The numbers per key are kept for the current month and the twelve before it; older months answer with zeros. ### In Node ```js // This month's usage of the key's project: node usage.mjs (Node 18 or later, no packages needed). const response = await fetch('https://api.postilio.eu/v1/usage', { headers: { Authorization: `Bearer ${process.env.POSTILIO_KEY}` }, }); const usage = await response.json(); if (!response.ok) { throw new Error(`Postilio answered ${response.status}: ${JSON.stringify(usage)}`); } console.log(`${usage.month}: ${usage.project.billable} billable, organization ${usage.organization.state}, this key sent ${usage.apiKey.sent}`); ``` ### In C# ```csharp // This month's usage of the key's project: dotnet run Usage.cs (.NET 10, no packages needed). // A file-based app is compiled ahead of time, without reflection-based JSON; in a project, leave this line out. #:property PublishAot=false using System.Net.Http.Headers; using System.Net.Http.Json; using var http = new HttpClient { BaseAddress = new Uri("https://api.postilio.eu/") }; http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("POSTILIO_KEY")); var response = await http.GetAsync("v1/usage"); if (!response.IsSuccessStatusCode) { throw new HttpRequestException($"Postilio answered {(int)response.StatusCode}: {await response.Content.ReadAsStringAsync()}"); } var usage = await response.Content.ReadFromJsonAsync(); Console.WriteLine($"{usage?.Month}: {usage?.Project.Billable} billable, organization {usage?.Organization.State}, this key sent {usage?.ApiKey.Sent}"); record Usage(string Month, bool Final, DateTimeOffset ResetsAt, UsageOrganization Organization, ProjectUsage Project, KeyUsage ApiKey); record UsageOrganization(string? Plan, string? State); record ProjectUsage(Guid Id, long Billable, long Accepted, long Suppressed, long Delivered, long Bounced, long Complained); record KeyUsage(Guid Id, long Accepted, long Sent, long Suppressed, long Delivered, long Bounced, long Complained); ``` ## Errors | Status | Body | When | |---|---|---| | `400` | validation problem | `month` is not a month from 2020 up to the current one, as `yyyy-MM` | | `401` | `{"error": "invalid_api_key"}` | no key, or one that does not exist or was revoked | | `403` | `{"error": "insufficient_scope"}` | the key lacks `usage:read`; a test key never has it | ## In the portal Owners, Admins and Billing members see the whole organization under **Usage & plan**: this month against the plan's limit with a forecast at the current pace, every project, a chart per day and the twelve months before, with a CSV export per month. The numbers are the same as here. The numbers per key are under **Keys & SMTP**, for the members who manage the project's keys: sent today, in 7 and 30 days and this month, suppressed, bounces and complaints, and a chart per day for each key. Revoked keys stay there while they have numbers. Source: https://docs.postilio.eu/data-retention.md # Data retention What Postilio keeps of the mail you send, where, and for how long; and what deleting a project, an organization or an account removes. Postilio is the processor here: it keeps nothing of your mail longer than below. ## A message's content The subject, the text and HTML bodies, the attachments and `Reply-To` are needed to send the message, and are held only until the receiving mail server has it: 1. **The outbox**, in Postilio's database, from the moment the API or SMTP accepts the message until it is handed to the mail server that delivers it: normally under a second. A message that cannot be handed on within 24 hours expires. The row is removed the moment it is handed on. A [scheduled](sending.md#scheduled-sending) message waits here until its `sendAt`, at most 30 days, and its content is removed at once when you cancel it. 2. **The delivery queue** of that mail server, until the receiving server accepts the message or turns it down for good. A message that is still deferred after 24 hours expires and is removed. After that the content is gone. It is never written to the message log, the delivery logs or the database backups: the backups leave out the outbox. That holds for scheduled messages too: should Postilio ever restore its database from a backup, a message that was still scheduled is not sent. It ends as `canceled` with the reason `lost_in_restore`, and your webhooks hear about it, so you can send it again. ## Content screening Postilio checks the content of every message it accepts for abuse, automatically, when it is accepted. The check runs on Postilio's own servers in the EU; no content leaves them. Postilio keeps the outcome (a score and the names of the rules that matched) for at most 30 days, or as long as the project keeps its message log when that is shorter, never the content itself. No person reads the content for this check, and for now it changes nothing for your messages: they are sent as they would be without it. To recognise a message it has seen before, Postilio keeps per project a fingerprint of each kind of message it sends: a one-way hash of its text with numbers, dates and codes taken out, the domains its links point to and the types of its attachments. A fingerprint is removed once the project has not sent that kind of message for 90 days. Postilio also keeps per organization and day how many messages scored what and which rules matched, as counts only, for 13 months. All of it goes when the project or organization is deleted. ## The message log What you see on the Messages page and through `GET /v1/emails/{id}`: per recipient the sender, the recipient, the tag, the size, the status and every event, with the receiving server's answer. The **subject** is kept only when the project keeps subjects (a project setting; on by default). The log is kept for the project's log retention, 30 days unless you changed it; your plan can keep it shorter (see [Plan limits](errors.md#plan-limits)). For a scheduled message that time counts from its `sendAt`, so it is not removed before it was sent. ## The delivery logs The mail server writes its own log of each delivery attempt: the message id, the recipient, the sender, the receiving server and its answer. Never the subject or the content. These logs are removed after 24 hours, the shortest log retention a project can have; the events you see are copied to the message log before that. ## Bounce reports When a receiving server sends a message back after it accepted it ([a bounce after delivery](delivery-status.md#a-bounce-after-delivery)), Postilio keeps of that report its status code, the name of the server that sent it and its reply, with addresses (all but the domain), IP addresses and identifiers removed and cut at 200 characters. Never the recipient's full address, the returned message or its headers. Postilio keeps this for 90 days to check its own deliverability and abuse; the same reply shows on the message for as long as the message log keeps it. ## Received mail For [inbound mail](inbound.md) your organization is the controller of what it receives and Postilio its processor, as for the mail you send. Postilio keeps: - **The content** (the message as it arrived, its parsed form and its attachments), encrypted, in Postilio's database in the EU: until 24 hours after your endpoint took it, and 4 days after it arrived at the latest; a message its route held back 24 hours. `DELETE /v1/inbound/messages/{id}/content` removes it sooner. The content is never in the backups, the logs or the webhook delivery log; should Postilio restore its database, a message not yet delivered ends as `expired` with the reason `lost_in_restore`. - **The metadata** (the envelope, `From`, the subject when the project keeps subjects, `Message-ID`, size, the spam and authentication results, the status): for the project's log retention, like the message log. The portal shows the metadata only, never the content; Postilio staff see neither the content nor the full addresses. Each download of an attachment or the raw message through the API is in your organization's audit log. ## DMARC reports (Seal) The DMARC and TLS reports receivers send to your organization's Seal address hold no message content and no recipients, only sending IP addresses, counts and authentication results. Postilio keeps: - **The reports as received**, compressed: their content 14 days, the fact that one came 30 days. They are never in the backups; should Postilio restore its database, the totals below come back, but the reports' files do not. - **The daily totals** per domain, source and result (for TLS reports: per MX and result), the reports' metadata and each source's first and last day: for the period your organization chose, 3, 13 (the default) or 24 months. - **Reverse DNS and network (ASN) of a sending IP**: 30 days, then looked up again. The network comes from a dataset in Postilio's own servers ([iptoasn.com](https://iptoasn.com)'s public-domain IP-to-ASN data, renewed with every release); no IP address is sent to an outside service to find it. If Postilio withdraws Seal from your organization, none of this changes: the data stays under the same periods, and it is deleted when your organization itself is deleted ([details](seal.md)). ## What Postilio staff can see > **Not yet active.** Asking for your permission and the emergency access described below are not switched on yet. This > section describes how they will work, including what **Settings › Support access** then shows for them; this note goes > once they are switched on. Postilio's support team works with the delivery metadata of your messages: the recipient's domain, the status, the receiving server's codes and replies, and the IP addresses Postilio sent from. Full addresses are masked (`•••@example.com`) and subjects are hidden. The content is kept only until the message is sent (above), and support has no way to open it. Seeing the full recipient or sender address, the subject or the Message-ID of a message needs your permission: - Postilio support asks, for one message or for all of your messages, for a time and with a reason. Your Owners and Admins get an e-mail and a banner in the portal, and have 72 hours to answer. - One Owner or Admin allows it, for as long as asked or shorter (at most 7 days), or declines it. An approval can be revoked at any time under **Settings › Support access**; that also ends a look that is open at that moment. - Every look is in your audit log, with its reason. Someone at Postilio who is also a member of your organization cannot answer for it. Searching for one full address that Postilio was given, for example in a complaint, does not need your permission: it shows only the messages to that address, and is in your audit log. Only in an emergency (abuse or a safety risk, a legal obligation, an outage, or another urgent reason, which it explains) can Postilio open this without asking. A second Postilio administrator confirms it first, where there is one, and it lasts an hour. Your Owners and Admins are told by e-mail straight away, with the reason. It shows in your audit log and in a red banner on every page until one of them has acknowledged it, for up to 30 days. Acknowledging is not consent: it stays in the history. Questions or objections: reply to that e-mail. Requests, answers and forced access are kept for 24 months, also after the organization is deleted, so that both sides can account for them. While the organization exists, **Settings › Support access** lists them. ### Support signing in as one of your users > **Not yet active.** Signing in as a user is switched off. This section describes how it works once it is switched on; > this note goes then. Postilio support can sign in to the portal as one of your users. **It does not ask for your permission first**, and you cannot switch it off in advance. The permission described above is for looking from Postilio's own administration pages; it does not cover this. A support session sees recipients and subjects without that permission. **Who and how.** A Postilio platform administrator, who confirms each start with a passkey and gives a reason and a support ticket. You read both as they were written. A session lasts 15, 30 or 60 minutes and cannot be extended. **What support sees.** What the user sees in the portal, in every project and organization that user can open: full sender and recipient addresses, subjects where the project keeps them, Message-IDs, each message's events, suppressions, test addresses, members and settings. **Never message content**: not of mail you send, and not the text, attachments or raw message of mail you [receive](inbound.md). Exports and downloads are refused, and the session gives no access to the API, SMTP or the AI assistant connection. **What support can change.** Support chooses before the session starts, and that stays fixed: - **Look only:** every change is refused. - **Act as the user:** support can also create, change and delete notification rules and send a test notification; check a sending domain, a receiving domain or a Seal domain again; deliver a received message to your endpoint again; and retry webhook deliveries or send a webhook test event. Only what the user's role allows. Everything else is refused in both, among it: passwords, passkeys and two-factor sign-in, API keys, AI access and other secrets, webhook addresses and other new destinations for data, members and roles, creating, renaming and deleting, plan limits, exports, sending mail and pausing a project. **What you are told.** When a session starts, the user and the Owners and Admins of every organization the user is in get an e-mail, and so again when it ends, with what was changed and what was refused. These e-mails cannot be switched off. An Owner or Admin reads only about the organizations they run. While a session runs, the user, the Owners and the Admins see a red bar in the portal with **End now**. That ends this session; support can start a new one, and you are told again. The user can end it too. **What is recorded.** Your audit log holds the start and the end, in every organization the user is in, with the name of the person from Postilio support. Each change, each refused attempt and each page looked at (at most once a minute per page) is an entry with both names; refused attempts and pages are entered in the organization the session started from. The entries stay as long as your audit log keeps entries. Postilio also keeps a record of each session: who signed in and as whom, the organization it started from, the mode, reason and ticket, when it started and ended, how it ended and who ended it, and the network address the support person worked from (the IPv4 address, or the first four parts of an IPv6 address). The record is kept for 24 months after the session ended, also after the organization or the account is deleted; a deleted account is no longer named in it. Postilio's own administration log keeps its entries for 24 months. **Settings › Support access** lists the sessions to Owners and Admins, and to each user those as themselves. ## Backups The database is backed up daily. A backup is kept for at most 30 days; the copy that leaves the server is encrypted before it does. A backup holds the message log, the suppression list and the account and organization data as they were that night, never the content of a sent or received message (above). Something you delete is therefore gone from the running service at once, and from the backups once the last backup taken before the deletion expires. ## Deleting | You delete | At once | Afterwards | |---|---|---| | A sending domain | Mail from it stops; its DKIM key is withdrawn from DNS | Its messages stay in the project's log until the log retention removes them | | A project | Its keys stop working; it is gone from the dashboard | Once its DKIM records are withdrawn (minutes): its message log, events, suppressions, webhooks and statistics. Messages already in the delivery queue are still delivered, or expire within 24 hours. Delivery logs: within 24 hours. Usage numbers are kept for billing | | An organization | Nothing for 30 days, so it can be restored; its keys stop working | After the 30 days: every project as above, then its members, invitations and audit log. Postilio support's requests stay for their 24 months ([above](#what-postilio-staff-can-see)) | | Your account | Signing in stops | After 7 days: the account itself. Your name and address in organizations' audit logs are replaced by a pseudonym | In all cases the data then leaves the backups within the 30 days above. ## Sessions and invitations A signed-in session holds your browser's name and the first two parts of your IP address; it is removed when it expires. An invitation that was never accepted is removed 30 days after it expired. ## Test email addresses An address you add for [test emails](test-emails.md) is kept, confirmed or still waiting for its link, until you remove it under **Test mail**, or until its project or your account is deleted. It stops counting as soon as you leave the organization. The audit log names it only masked (`ma•••@example.com`). ## Notifications Owners and Admins can have Postilio tell people when something needs attention: a bounce or complaint rate over a threshold, paused sending, a limit nearly reached, a domain problem, a new API key or webhook. Rules and channels are set in the portal under **Notifications**. - **What a notification holds:** names and counts only: of your organization, projects, domains, API keys and webhook hosts. Never a message's content, subject or recipient. - **E-mail** goes out through Postilio's own system mail, to the addresses you chose or to the organization's Owners and Admins. - **Slack and Discord** are US services. Choosing one sends those names and counts to it, where they are kept under that service's own terms, outside the EU. The portal asks you to confirm that choice when you add the channel. - **The webhook URL** of a Slack or Discord channel works like a password. Postilio keeps it encrypted and shows only its end after you saved it; replace it or delete the channel in the portal. - **What is waiting to be sent** is kept until it went out, at most a day when a channel keeps failing, and removed 7 days later. Channels and rules are deleted with their project or organization. Source: https://docs.postilio.eu/seal.md # Seal: DMARC monitoring Seal reads the DMARC aggregate reports that receivers send about your domains and shows who sends email as them, what passes, and when it is safe to move to `p=quarantine` and `p=reject`. You turn it on per organization in the portal (**Seal**); there is no `/v1` API for it yet. ## Who can do what Owners and Admins manage Seal: add and remove domains, mark sources as known, change the settings. Developers and Viewers read it; Billing has no access. Soon an Owner or Admin can also give someone more or less in Seal than their role does (Viewers and Billing at most reading: they never change anything), or invite a **Member**: someone with no access to Dispatch, only to what they are given per product, such as Seal. ## Price On a plan that includes Seal, the domains your plan includes are free; on any other plan your first domain is. Every other monitored domain is €2 per month. Billing starts when invoicing launches; until then nothing is charged. ## Report address Each organization gets one address, `@rua.pstlmta.net`, for all its domains. Put it in the `rua=` of each domain's DMARC record (what each tag does: [DMARC tags](dmarc.md)); Postilio publishes the authorization record (`._report._dmarc.rua.pstlmta.net TXT "v=DMARC1"`) that lets receivers send reports for your domain to it. Reports for a domain that is not in Seal are dropped unread. **Rotate address…** in Seal's settings gives a new token. The old address takes reports for 30 more days; update the `rua=` of each record within that time. ## TLS reports SMTP TLS reports (TLS-RPT, RFC 8460) tell you when other servers could not deliver mail **to** your domain over TLS: an expired certificate, an MX without STARTTLS, an MTA-STS or DANE policy that failed. They are about receiving, not sending. To have them in Seal, publish a TXT record at `_smtp._tls.`: ``` v=TLSRPTv1; rua=mailto:@tls.pstlmta.net ``` With a record already there, add the address to its `rua=`, separated by a comma. No authorization record is needed for TLS reports. Seal's settings (**TLS reports**) show per domain whether the record sends reports to Seal, the record to publish, and of the last 30 days the sessions with TLS, the failed ones, and the failures per MX and type. The report address is your organization's, with the same token as for DMARC; rotating it changes both. ## What is kept, and for how long - **Daily results per source** (sending IP, counts, SPF and DKIM results, the domains they checked, the receiver's verdict) and the daily TLS sessions per MX: 3, 13 (the default) or 24 months, a setting for the whole organization. A shorter period deletes the older days within the hour, for every domain; the change is in the audit log (`seal.retention_changed`). - **Report files (XML, JSON)**: 14 days, so they can be read again after a parser fix. - **Forensic (failure) reports**: not accepted. They can contain message headers and content; Seal works fully without them. A report holds no message content and no recipient addresses. See also [Data retention](data-retention.md). ## When Postilio withdraws Seal from your organization Postilio can make Seal available to your organization, and withdraw it again. Both times the Owners get a short e-mail, without the reason. The change is also in your organization's audit log, as an entry by Postilio. - **Seal's pages close** and Seal leaves the product switcher. What was stored stays stored, under the retention above, and comes back unchanged if Seal is made available again. - **Your DMARC records still name our report address** in `rua=` until you change them. Postilio no longer accepts reports for your domains (within about 10 minutes), so you can remove the address when it suits you. If you do nothing, receivers keep sending to an address that refuses them. - **If you were still monitoring domains**, monitoring stops with the withdrawal; you cannot choose **Stop monitoring** any more. Postilio can then stop them for good (**Clean up Seal records**), so that if Seal is made available again later, nothing is monitored again until you add your domains. - **Retention stays the normal one** (3, 13 or 24 months). When your organization itself is deleted, its Seal domains and figures go with it. ## Sources, spoofing and the route - **Likely spoofing**: a source Seal does not recognize, that never passed DMARC, whose reverse DNS lookup answered without any name, and that sent at most 10 messages on at most 3 days, over everything Seal keeps of it. When any of that is not certain (the lookup failed or was not done yet, a name that does not point back, one pass) the source stays **Unknown**: a source of yours is never filtered away. - **Not mine**: you can mark unknown sources that never passed as not yours. Nothing is published or blocked; Seal leaves them out of the list of unknown sources. One that later passes DMARC is Unknown again, and you get the `seal_unknown_source` alert. In the audit log as `seal_source.not_mine` (and `seal_source.not_mine_undone`). - **The route to enforcement** only waits for sources that pass DMARC, always or sometimes: an unknown source that ever passed blocks, its failures break the clean days. Sources that never pass (spoofing) don't. Without known sources the pass rate has nothing to measure and does not count; with 14 days of reports, no known source and nothing that ever passed, Seal says **No legitimate mail seen**: you can move to reject once you checked that the domain sends no mail. **This domain does not send mail** then shows the three records to publish (SPF `v=spf1 -all`, your DMARC record with only `p=reject`, `rua` kept exactly, and a null MX `0 .`) next to what is published now. Seal publishes nothing. - **Network and country** come from the IP-to-ASN dataset Postilio keeps on its own servers; no IP leaves Postilio. The country is where the network is registered, not where the device is. ## Emails and alerts - **First report**: when a domain's first report arrives, the organization's Owners and Admins get one email. Switch it off in Seal's settings (or in step 3 of adding a domain); it is a setting for the whole organization. - **Notification rules** (organization settings, **Notifications**) have two Seal events, sent to email, Slack, Discord or ntfy like the other notification events. | Event | When | |---|---| | `seal_unknown_source` | A source Seal does not recognize started sending as one of your domains. Said once per source. Also when a source you marked as not yours passes DMARC: someone may be using your DKIM key or SPF. | | `seal_pass_rate_below` | A domain's DMARC pass rate over the last 7 days is below the rule's threshold (95 % unless you choose another). Said when it starts, when it changes and when it clears. | ## Notifications to your own endpoint A notification channel of the kind `webhook` posts each message to an HTTPS endpoint of yours. It is being rolled out: until it is switched on for your organization, the portal does not offer it. The request body: ```json { "type": "notification", "timestamp": "2026-11-15T09:30:00+00:00", "data": { "title": "acme.example: 203.0.113.77 sends as it, and Seal does not know it", "lines": ["acme.example: 203.0.113.77 sends as it, and Seal does not know it"], "critical": false } } ``` One request can carry several lines: messages that come together are sent as one. The lines name a domain, an IP address and counts, never message content. The channel's signing secret (`whsec_…`) is shown once, when you add the channel or give it a new URL. Requests are signed like [project webhooks](webhooks.md#verifying-the-signature): `webhook-id`, `webhook-timestamp` and `webhook-signature` (HMAC-SHA256 over `{webhook-id}.{webhook-timestamp}.{body}`), and the same examples verify them. The endpoint must be a public `https://` address, checked when you add it and on every request, as in [Which URLs are allowed](webhooks.md#which-urls-are-allowed). Source: https://docs.postilio.eu/dmarc.md # DMARC tags A DMARC record is one TXT record at `_dmarc.` made of `tag=value` pairs separated by semicolons. This page explains every tag: what it does, what you can set it to, and what is safe to change. Postilio links here from Seal, from the domain page and from the DMARC wizard, so each tag has its own heading and a stable address, for example `dmarc.html#p`. ``` v=DMARC1; p=quarantine; rua=mailto:@rua.pstlmta.net; adkim=s; aspf=r ``` The tags and their defaults follow RFC 9989, the DMARC standard of May 2026 that replaces RFC 7489. Tags that RFC 9989 dropped are marked **no longer used** and described in [the last section](#tags-that-are-no-longer-used). A receiver that still follows RFC 7489 does not know `np`, `psd` and `t` and ignores them, so write a record that is also safe when they are ignored. How a record is read: - Spaces around `;` and `=` do not matter, and a semicolon after the last tag is fine. - Tag names are case-insensitive. Only `DMARC1` in `v=` is case-sensitive. - A tag a receiver does not know is ignored. Postilio shows it as unknown, without a link. - A domain has one DMARC record. With two at the same name, receivers discard both. ## Overview | Tag | Does | Default | |---|---|---| | [`v`](#v) | Marks the record as DMARC | none, required, first | | [`p`](#p) | What receivers do with mail that fails | `none` when absent | | [`sp`](#sp) | The same, for subdomains | the value of `p` | | [`np`](#np) | The same, for subdomains that do not exist | `sp`, else `p` | | [`psd`](#psd) | Marks a public suffix domain | `u` | | [`t`](#t) | Test mode: receivers go one step softer | `n` | | [`adkim`](#adkim) | How strictly the DKIM domain must match From | `r` | | [`aspf`](#aspf) | How strictly the SPF domain must match From | `r` | | [`rua`](#rua) | Where aggregate reports go | none: no reports | | [`ruf`](#ruf) | Where per-message failure reports go | none: no reports | | [`fo`](#fo) | Which failures trigger a failure report | `0` | ## The tags ### `v` The version. It identifies the text as a DMARC record. - **Value:** `DMARC1`, in capitals. No default. - **In practice:** it must be the first tag. A record that does not start with `v=DMARC1` is ignored in full. - **Usual mistake:** `v=dmarc1`, or another tag in front of it. Postilio reports this as `version`. - **In Seal:** a record without a valid `v=` is shown as invalid. - **Example:** `v=DMARC1; p=none` ### `p` The policy: what receivers are asked to do with mail that claims your domain and fails DMARC. - **Values:** `none` (deliver as usual, only report), `quarantine` (treat as suspicious), `reject` (refuse). Without `p`, a record is read as `p=none`. RFC 9989 recommends it; RFC 7489 required it. - **In practice:** `none` changes nothing for your mail and starts the reports. `quarantine` and `reject` also stop other people sending as you, and also stop your own mail that fails. - **Recommended:** start with `none`, move up only when Seal shows that everything of yours passes ([the route to enforcement](#the-route-to-enforcement)). - **Usual mistake:** going to `reject` at once. Mail from a forgotten system, a mailing list or a forwarder is lost. - **In Seal:** *Policy* on the domain page. When `t=y` is set it says so, because receivers then apply one step less. - **Example:** `p=quarantine` ### `sp` The policy for subdomains of the domain the record is published on. It does not apply to the domain itself. - **Values:** the same as `p`. Without `sp`, subdomains follow `p`. - **In practice:** use it to be stricter or softer on subdomains than on the main domain. It is ignored in a record published on a subdomain; receivers then use that record's `p`. - **Recommended:** leave it out until you have a reason; then set it equal to the policy you are heading for. - **Usual mistake:** `sp=none` left behind after `p=reject`, which keeps every subdomain open to spoofing. - **In Seal:** Seal reads the policy that applies to the domain being looked at, so on a subdomain without its own record it uses `sp` of the parent record when there is one. - **Example:** `p=reject; sp=quarantine` ### `np` The policy for subdomains that do not exist in DNS. It is new in RFC 9989 and absent from RFC 7489. - **Values:** the same as `p`. Without `np`, those subdomains follow `sp`, else `p`. - **In practice:** nobody sends legitimate mail from `invoice-2fa.example.com` if it does not exist, so `np=reject` is usually safe. Receivers that follow RFC 7489 do not know the tag and ignore it. - **Recommended:** `np=reject` once `p` is `reject`. Seal's route ends with this step. - **Usual mistake:** expecting `np` to cover subdomains that exist; it does not. - **Example:** `p=reject; np=reject` ### `psd` A flag for public suffix domains, such as a registry's `co.uk`. It is new in RFC 9989. - **Values:** `y` (this is a public suffix domain), `n` (this is an organizational domain, the top of its own tree), `u` (unknown, the default). - **In practice:** it tells receivers where to stop when they walk up the DNS tree looking for a record. Only the operator of a public suffix needs `y`. - **Recommended:** leave it out. `psd=n` says your domain is its own organizational domain, for itself and its subdomains; that is the only value an ordinary domain owner would ever use. - **Usual mistake:** `psd=y` on an ordinary company domain: it claims the domain is a public suffix. - **In Seal:** Postilio follows `psd` when it looks for a domain's record; a value other than `y`, `n` or `u` makes the record invalid. - **Example:** `psd=n` ### `t` Test mode. It is new in RFC 9989 and takes over a part of what `pct` did. - **Values:** `y` (receivers apply the policy one step softer: `reject` becomes `quarantine`, `quarantine` becomes `none`), `n` (apply it as published, the default). - **In practice:** reports are unaffected, so you see what the policy would do before it does it. `t=y` has no effect on `p=none`. - **Recommended:** set `t=y` for a first period after raising `p`, then remove it once the reports stay clean. - **Usual mistake:** leaving `t=y` for good and thinking the policy is enforced. Receivers that follow RFC 7489 do not know the tag and enforce `p` as written. - **In Seal:** the route to enforcement uses it: each raise of `p` comes with `t=y` first. The domain page shows *testing, t=y* next to the policy. - **Example:** `p=quarantine; t=y` ### `adkim` How strictly the domain in the DKIM signature (`d=`) must match the domain in the visible From address. - **Values:** `r` (relaxed: a parent or child domain also matches, the default) and `s` (strict: the exact same domain). - **In practice:** DKIM only counts for DMARC when the domains align. Relaxed accepts a signature for `mail.example.com` on mail from `example.com`; strict does not. - **Recommended:** `s` for mail Postilio sends: it signs with exactly your domain, so it aligns either way. Keep the default when other services sign on a subdomain. - **Usual mistake:** `adkim=s` while a service signs with its own subdomain: its mail then fails. - **In Seal:** the starter record Postilio proposes has `adkim=s`. - **Example:** `adkim=s` ### `aspf` How strictly the domain SPF checked (the return path) must match the From address. - **Values:** `r` (relaxed, the default) and `s` (strict). - **In practice:** Postilio's return path is `bounce.`, a subdomain, so it aligns only when relaxed. With `aspf=s` your Postilio mail passes DMARC on DKIM alone. - **Recommended:** leave it at `r`. - **Usual mistake:** `aspf=s` as a "more secure" setting. DKIM then carries every message; one broken signature and the mail fails. - **In Seal:** the domain page tells you that `aspf=s` makes DMARC rest on DKIM alone (the advice `spf_strict`). - **Example:** `aspf=r` ### `rua` Where receivers send aggregate reports: the daily summaries of who sent mail as your domain and whether it passed. - **Value:** a comma-separated list of `mailto:` addresses. There is no default: without `rua`, no aggregate reports are sent. An old `!10m` size limit after an address is obsolete syntax that receivers ignore. - **In practice:** this is the tag that feeds Seal. Every report you want to see must go to an address in the list. - **Recommended:** keep any address you already have and add Seal's, separated by a comma. Never replace someone else's. - **Usual mistake:** two `rua=` tags instead of one list. Seal reads only the first; put every address in one tag. - **In Seal:** your organization's address is `@rua.pstlmta.net`, the same for all your domains. Seal reads the reports that arrive there; a record without that address gets no reports into Seal. - **Example:** `rua=mailto:dmarc@example.com,mailto:@rua.pstlmta.net` ### `ruf` Where receivers send failure reports: one report per failing message. Few large receivers send them. - **Value:** a comma-separated list of `mailto:` addresses. Without `ruf`, no failure reports are sent, and `fo` is ignored. - **In practice:** a failure report can contain parts of the original message. RFC 9989 notes that receivers concerned about privacy either redact such reports heavily or do not send them at all. - **Recommended:** leave it out unless you run your own system to receive and handle them. - **Usual mistake:** pointing it at a shared mailbox without checking who can read it. - **In Seal:** Seal does not use `ruf`. It does not read failure reports, and it never asks for them. - **Example:** `ruf=mailto:failures@example.com; fo=1` ### `fo` Which failures should cause a failure report. It only matters together with `ruf`. - **Values:** `0` (a report when every check fails to align, the default), `1` (when any check fails to align), `d` (when a DKIM signature failed), `s` (when SPF failed). Combine with a colon, for example `fo=0:d`; `0` and `1` exclude each other. - **In practice:** `1` gives the most reports. It does nothing without `ruf`. - **Recommended:** leave it out. - **Usual mistake:** setting `fo` and expecting reports without `ruf`. - **In Seal:** not used, because Seal does not use `ruf`. - **Example:** `fo=1` ## The route to enforcement You do not set `p=reject` on day one. You publish `p=none` with `rua`, read the reports, fix what fails and raise the policy a step at a time: 1. `p=none` with `rua`. Nothing changes for your mail; the reports start. 2. `p=quarantine; t=y`: receivers treat failures as `none` while the reports show what quarantine would do. 3. `p=quarantine`, without `t`. 4. `p=reject; t=y`, then `p=reject`. 5. `np=reject` for subdomains that do not exist. Seal walks you through it on the **Enforcement route** page of a domain and says when each step is safe; how it decides is in [Seal](seal.md#sources-spoofing-and-the-route). The old way to ramp up, `pct`, is [no longer used](#pct): use `t=y`. ## Tags that are no longer used RFC 9989 marks these three as historic. Receivers that follow it do not read them; receivers that follow RFC 7489 may. Do not rely on them, and remove them when you next edit the record. Postilio reports them as `obsolete_tag`. ### `pct` The percentage of failing mail the policy applied to, from RFC 7489. - **Values:** an integer from 0 to 100; the default was 100. - **In practice:** RFC 9989 says it was usually not applied accurately unless the value was 0 or 100. It replaced part of its use with [`t`](#t). - **Recommended:** remove it; use `t=y` while you test a policy. - **Usual mistake:** `p=reject; pct=10` as a safe start: where `pct` is not applied, `reject` applies to everything. - **Example:** `pct=25` (do not use) ### `ri` The interval between aggregate reports in seconds, from RFC 7489. The default was 86400, one day. - **In practice:** RFC 7489 only required daily reports; anything else was best effort. - **Recommended:** remove it. - **Example:** `ri=3600` (do not use) ### `rf` The format of failure reports, from RFC 7489. The default and only value was `afrf`. - **In practice:** it never offered a choice. - **Recommended:** remove it. - **Example:** `rf=afrf` (do not use) Source: https://docs.postilio.eu/ai-assistants.md # AI assistants An AI assistant in your editor or chat app can read these docs for you while you build on Postilio: through the docs server, an MCP server that searches the guides, the API reference and the error codes, or by fetching the docs as Markdown. With an AI access it can also look into one of your projects: why a domain is pending, why a message bounced, whether an address is suppressed, how your webhooks are doing. ## The docs server `https://mcp.postilio.eu/docs` is an MCP server (Streamable HTTP) with the public Postilio docs. It needs no key and no account: it reads these docs and nothing else, never your organization, messages or keys. > **Note.** Postilio's MCP servers run at `mcp.postilio.eu` only: `/docs` and, for your projects, `/v1`. Postilio > publishes no MCP package on npm or anywhere else; a package or server that says it is Postilio's and runs somewhere else > is not ours. ### Add it to your assistant In Claude Code, for all your projects: ```sh claude mcp add --transport http --scope user postilio-docs https://mcp.postilio.eu/docs ``` In Cursor, in `~/.cursor/mcp.json`: ```json { "mcpServers": { "postilio-docs": { "url": "https://mcp.postilio.eu/docs" } } } ``` In VS Code, in `.vscode/mcp.json` of your project or in your user configuration: ```json { "servers": { "postilio-docs": { "type": "http", "url": "https://mcp.postilio.eu/docs" } } } ``` In the Claude apps and in ChatGPT, add it as a custom connector with the URL above and no authentication. Any other client: the URL, the Streamable HTTP transport (often called `http`), no authentication. ### Tools | Tool | What it does | |---|---| | `search_docs` | Searches the guides and the API reference for `query` (a few words, at most 120 characters) and returns the best sections, best first, each with its URL and the words around the match. `limit`: 1 to 10, 5 if left out | | `get_doc` | Returns a guide as Markdown (`page`, such as `sending` or `domains`), or one section of it (`section`: its anchor or its heading), with the list of its sections. A guide over 20,000 characters is cut off; ask for a section then | | `get_api_operation` | Returns an operation of the API from its OpenAPI document: parameters, request body, responses and every schema it uses. By `operationId` (such as `SendEmail`), or by `method` and `path` (such as `POST` and `/v1/emails`) | | `list_error_codes` | Lists the error codes of the API with their HTTP status and meaning, the table in [Errors and limits](errors.md#error-codes). `filter` keeps the codes whose code or meaning contains it, or with that status | Every tool only reads, and says so to your assistant, so most assistants call them without asking you first. A result is JSON with the URL of the page it came from, so you can check what the assistant read. ### Limits - 120 tool calls a minute per IPv4 address, or per IPv6 /64. Over it, a call answers as a tool error with `{"error": "rate_limited", "retryAfterSeconds": 12}`, not with HTTP `429`. - A request from a web page (one with an `Origin` header) is refused with `403`: the server is for assistants and editors, not for scripts in a browser. ### Changes Within `/docs` the tools only change in ways that do not break an assistant that uses them: new tools, new optional arguments, new fields in a result. A tool that is renamed or removed, or a field that changes its meaning, gets a new path; the old one keeps working for at least six months, and **What's new** in the portal says so. ## The project server `https://mcp.postilio.eu/v1` is an MCP server (Streamable HTTP) for one project. It takes an **AI access**: a key of its own, `pk_ai_…`, that you make in the portal under **Keys & SMTP › AI assistants**, or a connection you allow when an assistant signs in ([Connect with a sign-in](#connect-with-a-sign-in), for the Claude apps and ChatGPT). An AI access belongs to one project, always expires (30 days unless you choose otherwise, a year at most) and only reads, unless you let it send test emails to your own addresses. It works only here: the API and SMTP refuse it, and this server refuses an API key (`pk_live_…`). The server has the docs tools too, so one server is enough. ### Add it to your assistant In Claude Code, for all your projects: ```sh claude mcp add --transport http --scope user postilio https://mcp.postilio.eu/v1 --header "Authorization: Bearer pk_ai_..." ``` In Cursor, in `~/.cursor/mcp.json`: ```json { "mcpServers": { "postilio": { "url": "https://mcp.postilio.eu/v1", "headers": { "Authorization": "Bearer pk_ai_..." } } } } ``` In VS Code, in your user configuration, with the key in VS Code's secret storage: ```json { "inputs": [{ "type": "promptString", "id": "postilio-key", "description": "Postilio AI access", "password": true }], "servers": { "postilio": { "type": "http", "url": "https://mcp.postilio.eu/v1", "headers": { "Authorization": "Bearer ${input:postilio-key}" } } } } ``` Any other client: the URL, the Streamable HTTP transport, and the header `Authorization: Bearer pk_ai_…`. Keep the key out of a repository: it reads your project. The Claude apps and ChatGPT cannot send a header: they connect with a sign-in. ### Connect with a sign-in The Claude apps (web, desktop and mobile), ChatGPT and other assistants that support OAuth connect without a key: you sign in to Postilio and choose what the assistant may do. The URL is the same, `https://mcp.postilio.eu/v1`, exactly as written (no slash at the end). **Claude** (claude.ai, Claude Desktop, Claude mobile): 1. In Claude, open **Settings › Connectors** and choose **Add custom connector**. 2. Name it Postilio, enter `https://mcp.postilio.eu/v1` and add it. Leave the advanced settings (client ID and secret) empty. 3. Choose **Connect**. Your browser opens Postilio; sign in with your password and code, or a passkey, if you weren't signed in yet. 4. Postilio asks whether to connect **claude.ai**. Check that it names the app you started connecting, then choose the project, what Claude may read (domains and messages by default; test emails only if you tick them), whether it may see full recipient addresses and receiving servers' replies, and for how long (at most a year). 5. Choose **Allow**. Postilio may ask for your code once more. You're back in Claude, connected. Then ask Claude about your project, for instance *"Which domains does my Postilio project have, and are they verified?"* or *"Were there delivery problems this week?"*. Claude asks before it uses a tool, unless you let it. **ChatGPT**: add Postilio as an app or connector with the URL `https://mcp.postilio.eu/v1` and **OAuth** as the authentication (where this lives depends on your ChatGPT plan, for example developer mode under **Settings › Apps**). ChatGPT opens Postilio; continue from step 3 above, where Postilio names **chatgpt.com**. **Claude Code** can sign in too, instead of using a key: `claude mcp add --transport http --scope user postilio https://mcp.postilio.eu/v1`, then `/mcp` and **Authenticate**. Postilio names **claude.ai** and says that the app runs on your computer, which is right for Claude Code. What you allow is an AI access like one made with a key: it appears under **Keys & SMTP › AI assistants** as **Connected with Claude** (or the app's name), for one project, with every call it makes, the same limits and the same masking. To disconnect, revoke it there: the assistant's next call is refused. When it expires, connect again. Owners, Admins and Developers of a project can connect it, as they can make an AI access. Only allow an app you started connecting yourself. The page names the website the app lives on; any other app than the Claude apps and ChatGPT gets a warning, as anyone can give an app any name. **For developers of an MCP client:** the server follows the MCP authorization specification. A `401` from `/v1` carries `WWW-Authenticate: Bearer resource_metadata="https://mcp.postilio.eu/.well-known/oauth-protected-resource/v1"`; the authorization server's metadata is at `https://portal.postilio.eu/.well-known/oauth-authorization-server`. It supports Client ID Metadata Documents (https, port 443, redirects on the document's own origin or loopback) and, as a fallback, dynamic client registration; public clients only, PKCE with `S256`, the `resource` parameter `https://mcp.postilio.eu/v1` on the authorization and the token request, and `iss` in the authorization response. Access tokens last an hour; refresh tokens turn over at every use, and a refresh token or code used twice ends the connection. ### Tools | Tool | Needs | What it does | |---|---|---| | `get_access` | | The project, what the access may do, whether it shows recipients and server replies, when it expires, and the tool calls left today | | `list_domains` | `domains:read` | The project's sending domains with their status, since when one is failing, and its DMARC status | | `get_domain` | `domains:read` | A domain (by id or name) with the DNS records it needs and whether each was found (with `newValue` on a record that still points at an older Postilio name), its DMARC record with advice, and the DKIM key record Postilio publishes | | `check_domain` | `domains:read` | Looks the domain's records up now instead of at the next check, as **Check now** in the portal does; once a minute per domain | | `get_email` | `emails:read` | A message by its id: status, sender, recipient and delivery events with their [reason](delivery-status.md) codes. Never the subject or the content | | `delivery_problems` | `emails:read` | The deferred, bounced, complained and expired messages of the last 24 hours or 7 days, per status and reason, with a few message ids. Never a recipient | | `check_suppression` | `suppressions:read` | Whether one address is suppressed, why and since when | | `list_webhooks` | `webhooks:read` | Your webhook endpoints: the origin of each URL (never its path or query), its events, whether it is paused or failing, its last delivery. Never a signing secret | | `list_webhook_deliveries` | `webhooks:read` | An endpoint's deliveries, newest first, with their status, attempts, the endpoint's last HTTP status and why an attempt failed (`timeout`, `connection_failed`, `redirect_not_followed`, `payload_too_large`, or `content_expired` for an inbound message whose content went before it was sent) | | `get_usage` | `usage:read` | The project's usage in a month and where the organization stands against its plan | | `send_test_email` | `emails:test` | Sends one test email from a verified domain to an address of your own: one a member confirmed under **Test mail**, or a member's. Postilio's sample message, or your own subject and plain text (at most 2,000 characters). Within the project's test emails of the day, and it counts as usage, like [test emails](test-emails.md) through the API | Plus the four [docs tools](#tools). An access has `domains:read`, `emails:read`, `suppressions:read` and `webhooks:read` unless you choose otherwise; `usage:read` and `emails:test` you add yourself. A tool the access may not use answers `insufficient_scope`. The server sees live messages only: a message sent with a test key is not found. Lists give at most 25 items, fewer when they hold long replies; a result with `next` has more, which the same tool gives with `cursor` set to it. ### Sending a test email `send_test_email` is the only tool that does something, so your assistant asks you before it calls it. A client that can ask in between (protocol 2026-07-28) shows you "Send a test email from … to …?" as well; if you decline, nothing is sent (`declined`). It can only reach your own addresses, so a hijacked assistant cannot turn it into a way to mail anyone else. Each one is in the audit log, by the AI access. Over the project's test emails of the day it answers `rate_limited` with the seconds until midnight UTC. ### What it shows, and what not - **Recipients are masked**, such as `ad•••@example.com`, unless the access shows them. - **Receiving servers' replies are left out**: an event says why with its reason code. An access that shows them gives them under `untrusted`, with what added a suppression and the start of your webhook endpoint's answers. - **Text from other systems is marked.** A receiving server or a webhook endpoint can answer anything, also text that tries to instruct your assistant. Such text only comes in a field `untrusted` (`{"source": "receiving_server", "text": "…"}`), at most 256 characters and without invisible characters, and the tools tell your assistant never to follow instructions in it. Marking it is no defence on its own: an assistant that can also browse or write elsewhere could still be talked into something, so give it no more tools than it needs. - Never the subject or content of a message, a webhook secret, a DKIM key or another key. ### Limits - 60 tool calls a minute and 2,000 a UTC day per AI access. Over it, a call answers as a tool error with `{"error": "rate_limited", "retryAfterSeconds": 12}`, not with HTTP `429`. `check_domain` answers the same when the domain was checked less than a minute ago. - A request without an AI access that holds is refused before any tool: `401` with `invalid_api_key` (no key, an unknown, revoked or ended one, or an API key) or `ai_access_expired`, and `403` with `client_ip_not_allowed` (outside the access's networks), `organization_suspended` or `project_suspended`. An access ends by itself when the member who made it leaves the organization or can no longer open the project, and when the project moves to another organization. - A request from a web page (one with an `Origin` header) is refused with `403`. Every tool call is in the access's log on its page in the portal, for 90 days: the tool, a summary of its arguments with addresses masked, the result and how many items came back, never what came back. ## The docs as Markdown An assistant that can only fetch pages reads the docs as Markdown: - [llms.txt](https://docs.postilio.eu/llms.txt) lists every guide with a line about it, in the [llms.txt](https://llmstxt.org/) format; - [llms-full.txt](https://docs.postilio.eu/llms-full.txt) has every guide in one file; - every guide is also there as `.md`, such as [sending.md](https://docs.postilio.eu/sending.md); - [openapi.json](https://docs.postilio.eu/openapi.json) is the OpenAPI document of the API, for a client generator too.