Send mail from your App
Your App can send mail itself from the domain of your site: a login link, an order confirmation, a new password. It goes from an address on your own domain, such as noreply@yourdomain.nl, so the person who gets it sees your name and not ours.
Only mail someone asked for. One mail to one person, because of something they did in your App. No newsletters, no mailing lists, and no mail to people who did not ask for it. Our mail service only allows this kind of mail.
What you need. A paid site on the App or Platform plan, with your own domain live and turned on for sending. Is that last part not done yet? Send a ticket and we turn it on. In the portal, on the Agents page of your site, you see which domain your mail goes from and how much you sent.
The key. On the same page you create a mail key. You see it once. Put it in your repository as a secret and pass it to your App with the GitHub Action, for example as MAIL_KEY in the input secrets. Keep it out of your code and out of the browser: whoever has the key can send mail as your site. You can have two keys at a time, so you can switch without failed mail. Create a new key, put it in your App, then revoke the old one.
Sending. Send a POST to https://dorelli.cloud/api/mail:
POST /api/mail
Authorization: Bearer <your mail key>
Content-Type: application/json
Idempotency-Key: order-1234-confirmation
{"from": "orders", "to": "customer@example.com", "subject": "Your order 1234", "text": "Thank you for your order.", "html": "<p>Thank you for your order.</p>"}
from is only the part before the @. The domain is always that of your site, and you cannot send from another domain. Without from, the mail goes from noreply. to is one address. Send text, html or both. The whole request is at most 256 KiB. Attachments, cc, bcc and your own headers are not possible.
Send an Idempotency-Key with every mail, for example the number of the order. If your App sends the same request again within a day, for example after a timeout, it gets the first answer back and no second mail goes out.
Limits. Per site 20 mails an hour, 100 a day and 1,000 a month. We count days and months by the calendar, in UTC. The 1,000 a month are included in your plan, also on Platform, where it does not count as usage and is not on your invoice. Above a limit you get status 429 with the limit and Retry-After in the answer, and nothing is sent. If too much of your mail does not arrive, we pause the mail of your site and look at it with you. If our mail service could not take a mail (503), that attempt still counts toward the hour. So during an outage your App tries at most 20 times an hour. Wait for the time in Retry-After before you try again.
Answers. The answer is JSON. On a refusal, error holds a code and message says what to do. The portal shows the latest refusals with their code.
| Status | What it means |
|---|---|
| 200 | Sent. |
| 202 | The mail service did not confirm. The mail may have gone, so do not send it again with a new key. |
| 400 | Something in the request is wrong. |
| 401 | No valid mail key. |
| 403 | The site is not active, it is not an App, or its mail is paused. |
| 409 | No domain is ready to send from yet, or a request with the same Idempotency-Key is still running. |
| 413 | Larger than 256 KiB. |
| 422 | The mail service refused this mail, or the Idempotency-Key belongs to another request. |
| 429 | A limit of your site is reached, or the daily limit of the whole platform. |
| 500 | Something went wrong on our side. Nothing was sent. |
| 503 | Try again later. Nothing was sent. |
What we keep. Per mail the site, the moment and whether it went. Not the address, the subject or the content. Thirty days. An Idempotency-Key we keep as a hash, for at most 30 hours.
Checked against the code on 25 November 2026 · Evidence: lib/klantdomein-api.ts, lib/klantdomein-sleutel.ts, lib/klantdomein-mail.ts, app/api/mail/route.ts