Postilio docs

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.

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 <orders@mail.example.com>",
    "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

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.