Postilio docs

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

curl https://api.postilio.eu/v1/emails \
  -H "Authorization: Bearer $POSTILIO_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Acme <no-reply@mail.example.com>",
    "to": ["ada.lovelace@example.com"],
    "subject": "Your sign-in code",
    "text": "Your code is 482913.",
    "html": "<p>Your code is <b>482913</b>.</p>",
    "tag": "sign-in",
    "replyTo": "support@example.com"
  }'

The key needs the emails:send scope. Examples in Node and C# are in the Quickstart.

FieldRules
fromRequired. An address on a verified domain of the project, optionally with a name: Acme <no-reply@mail.example.com>. 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.
toRequired. 1 to 50 addresses, each a bare address without a name.
cc, bccOptional. Bare addresses, only with exactly one address in to: see Cc and Bcc.
subjectRequired. At most 998 characters, no control characters.
text, htmlAt least one of the two. Send both and mail clients pick.
tagOptional. Up to 64 letters, digits, - or _; filter on it in the portal and find it in webhook events.
replyToOptional. One address, with or without a name.
attachmentsOptional. 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.
headersOptional. Up to 10 headers of your own, such as List-Unsubscribe: see Custom headers.
sendAtOptional. When to send it, from a minute to 30 days ahead: see 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 for what counts. Everything a request can hold is in the reference.

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:

{ "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).

A request that cannot be sent answers an error and stores nothing; Errors and limits 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'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.

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:

{
  "from": "Acme Support <support@mail.example.com>",
  "to": ["ada.lovelace@example.com"],
  "cc": ["account-manager@example.com"],
  "bcc": ["archive@example.com"],
  "subject": "Your ticket 4711",
  "text": "Solved: the export works again."
}

Custom headers

headers adds headers of your own to the message, as an object of names and values:

curl https://api.postilio.eu/v1/emails \
  -H "Authorization: Bearer $POSTILIO_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Acme <news@mail.example.com>",
    "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": "<https://example.com/unsubscribe/3f9a1c7e>, <mailto:unsubscribe@example.com?subject=3f9a1c7e>",
      "List-Unsubscribe-Post": "List-Unsubscribe=One-Click",
      "X-Campaign-Id": "october-2026"
    }
  }'
HeaderRules
List-UnsubscribeOne <https://…> URL, one <mailto:…> 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-PostOnly List-Unsubscribe=One-Click, and only together with an https URL in List-Unsubscribe (one-click unsubscribe, RFC 8058).
In-Reply-To, ReferencesOne 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….

What recipients see

Besides your own headers, every message carries:

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 and FAQ, Yahoo sender requirements, RFC 8058.

Scheduled sending

Add sendAt and the message waits until then, with the status scheduled:

# 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 <no-reply@mail.example.com>",
    "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):

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:

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.

StatusMeaning
acceptedstored, waiting to be handed to the mail server
scheduledstored, waiting for its sendAt
cancelednot sent: canceled while scheduled, or no longer allowed when it was due (see reason)
queuedhanded to the mail server
deferrednot delivered yet (the receiving server refused it for now, or could not be reached); it is tried again
deliveredthe receiving server accepted it
bouncedrefused for good, also when the bounce arrives after a delivery
expirednot delivered within a day; no more attempts
complainedthe recipient marked it as spam
suppressednot sent, because the address is on the suppression list

Look a message up with GET /v1/emails/{id} (scope emails:read):

curl https://api.postilio.eu/v1/emails/$EMAIL_ID \
  -H "Authorization: Bearer $POSTILIO_KEY"
{
  "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. 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. To hear about events as they happen instead of asking, use Webhooks.

SMTP

For software that sends mail over SMTP: point it at Postilio and log in with an API key.

SettingValue
Hostsmtp.postilio.eu
Port587 with STARTTLS (recommended), or 465 with TLS from the first byte
User nameapikey
Passwordan 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) works over SMTP with IPv6 networks too.

With curl (for 465, use smtps://smtp.postilio.eu:465 without --ssl-reqd):

cat > welcome.eml <<'MAIL'
From: Acme <no-reply@mail.example.com>
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:

// 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 <no-reply@mail.example.com>", "delivered@simulator.postilio.eu",
    "Welcome to Acme", "Hi Ada, your account is ready.");
await smtp.SendMailAsync(message);
Console.WriteLine("Accepted");

In Node, with nodemailer:

// 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 <no-reply@mail.example.com>',
  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 <id>

How a message is read

Limits and replies

LimitReply
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 closed552 5.3.4 message_too_large
50 recipients per message: the rest go in a next message452 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 DATA452 4.5.3 at RCPT TO, or 552 5.3.4 message_too_large_for_recipients
20 messages per connection: reconnect for more421 4.7.0
600 messages per key per minute451 4.7.1
10 connections at once from one address (over IPv6: one /64), of which 5 not logged in yetthe connection is closed
10 failed logins per 15 minutes from one address (over IPv6: one /64): wait454 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 dothe 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 affectedthe connection is closed
ReplyWhy
535 5.7.1 client_ip_not_allowedthe key is restricted to other networks
535 5.7.1 insufficient_scopethe key lacks emails:send
553 5.7.1 unverified_sender_domainthe envelope sender's domain is not verified (at MAIL FROM)
550 5.7.1 unverified_sender_domainthe From header's domain is not verified (after the message)
553 5.7.1 or 550 5.7.1 sender_domain_not_allowed_for_keythe key may not send from that domain (envelope or From header)
550 5.7.1 sandbox_recipient_not_allowedin the sandbox, a recipient outside your team and verified domains
451 4.7.1 sandbox_daily_limit_reached, sandbox_rate_limit_reacheda sandbox limit; a mail server tries again later
451 4.7.1 probation_daily_limit_reached, probation_rate_limit_reachedthe cap of the probation after the sandbox; a mail server tries again later
451 4.7.1 project_daily_limit_reached, project_rate_limit_reachedthe project's own limit, see Project limits; a mail server tries again later
451 4.7.1 plan_monthly_limit_reached, plan_daily_limit_reached, plan_rate_limit_reacheda limit of your plan, see Plan limits; a mail server tries again later
451 4.7.1 platform_rate_limit_reached, platform_daily_limit_reachedthe platform's safety limit per key or project, or on a project's test keys, see Platform limits; a mail server tries again later
554 5.6.0the 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_allowedan attachment is an executable file, see Attachments (the reply names it)
554 5.6.0 message_id_reused_with_different_contentthe same Message-ID with other content within 24 hours
554 5.7.1 organization_suspendedPostilio suspended your organization; the connection is closed
554 5.7.1 project_suspendedthe key's project is paused or suspended, see Paused projects; the connection is closed
530 5.7.0the key was revoked during the session
530 5.7.1 client_ip_not_allowed, 530 5.7.1 insufficient_scopethe key was changed during the session and may no longer send from here; the connection is closed
452 4.3.1 service_degradedPostilio takes no new messages for now, to protect its storage; a mail server tries again later
451 4.3.0, 451 4.3.2a temporary failure at Postilio, or busy; try again