Transactional email
Send one-to-one messages from your website or app, such as receipts, verification codes and password resets, through the API or the SMTP relay.
Send with the API
POST https://mailhoor.com/api/transactional/send with a JSON body:
curl -s -X POST https://mailhoor.com/api/transactional/send \
-H "X-Auth-APIKey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fromname": "YourBrand",
"fromemail": "orders@yourbrand.com",
"to": "sara@example.com",
"toname": "Sara",
"subject": "Your order {{ order_id }} is confirmed",
"body": "<html><body><p>Hi {{ name }}, thanks for your order.</p></body></html>",
"tag": "receipts",
"variables": {"name": "Sara", "order_id": "10452"}
}'
Parameters
| Field | Required | Description |
|---|---|---|
fromname |
Yes | Sender name |
fromemail |
Yes | Sender address, on a verified domain |
to |
Yes | Recipient address |
toname |
No | Recipient name, shown as Name <address> |
subject |
Yes | Subject line |
body |
Yes | HTML body |
replyto |
No | Reply-to address. Defaults to fromemail |
tag |
No | Groups messages in reports, such as receipts or passwordresets |
variables |
No | Values for Jinja2 templating in the subject and body |
template |
No | ID of a saved template. Its subject, body, sender, reply-to and tag are used instead of the ones in the call |
route |
No | A specific sending route, from /userroutes |
Templating
When you pass variables, the subject and body are rendered with Jinja2: {{ name }}, {% if %}, {% for %} and so on. Pass an empty object {} to use Jinja syntax without values. Templates built with the drag-and-drop editor support simple variable replacement only.
Tags
Tags can contain letters, numbers, _, - and ., up to 18 characters, and are case-insensitive. Each account can use up to 400 different tags. Messages without a tag are grouped as untagged.
Suppression
Transactional messages are not sent to addresses that are in an exclusion list, or that previously unsubscribed, complained or bounced. This protects your domain's reputation.
Send with SMTP instead
If your platform can only send through SMTP (WordPress, Laravel, an ERP and so on), use the SMTP relay.
Follow results
Open Email → Messages to see transactional messages by tag, with deliveries, opens, clicks and bounces. Use webhooks to receive events in real time.