
The short answer: each e-mail goes out from your sales system the moment the order status changes. When the payment comes in, the confirmation goes out, with the summary of what was bought; when the order is handed to the courier, the dispatch notice goes out. The confirmation and the summary can go in one e-mail or in two, as you prefer.
The moments and the e-mails
| Moment | What your system does | The e-mail |
| Payment confirmed | Marks the order as paid | "Order No. 8812 confirmed", with the amount and what comes next |
| Summary | Gathers the items, quantities and prices | What was bought, the total and the delivery address |
| Out for delivery | Hands the order to the courier | "Your order leaves for delivery today", with a contact |
The summary: the list goes in the HTML, not in a variable
Variables are for simple values, such as {{name}}, {{number}} and {{amount}}. In the HTML, values are escaped: a table of items passed in a variable would show as text, with the tags visible. Build the summary in your system and send it in html and in text. What you send in those fields replaces the template’s, and the subject still comes from the template:
curl https://api.mozout.com/v1/email/messages \
-H "Authorization: Bearer sandbox_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-8812-paid" \
-d '{"from": "Your Company <orders@yourcompany.com>",
"to": "joao.fernandes@example.com",
"template_id": 21,
"variables": {"name": "João", "number": "8812"},
"html": "<p>Hello João, order No. 8812 has been paid.</p><table>...</table>",
"text": "Hello João, order No. 8812 has been paid. ...",
"headers": {"X-Order-Id": "8812"}}'
For HTML that looks right on a phone and on a computer, see an HTML e-mail that displays everywhere.
Tying the e-mail to the order
Send the order number in a header of your own, in headers, such as X-Order-Id (up to 20 headers), and keep the id from the answer next to the order. Also use an Idempotency-Key with the number and the moment, such as order-8812-paid and order-8812-shipped: if the payment notice reaches your system twice, the customer does not get two confirmations. See retries and idempotency.
Many orders leaving at the same time
When several orders leave for delivery together, use POST /v1/email/messages/batch: one request, one message per customer, each with its own to and variables. The fields outside messages, such as the sender and the template_id, apply to all of them. There is no limit on the number of messages, only on the request size (8 MB), and results says what happened to each one. See sending in a batch.
| No promotions in these e-mails. A "you may also like" in an order confirmation turns a service e-mail into marketing. For promotions and news there is e-mail marketing: see e-mail marketing without burning your domain. |
| In the dispatch notice, give the order number and a contact, the courier’s or your team’s. If your system has a delivery tracking link, add it. A customer who knows who is coming to the door answers the phone. |
|
Want order confirmations and delivery notices to go out from your system on their own? See the Transactional E-mail page. See Transactional E-mail |
RECOMMENDED PRODUCT Professional e-mail on your domain Mailboxes in your company name, no adverts, with spam filtering. from ₦9,900.00/mo (3-year plan, with coupon) See plans |











