Before you start
Three things from Hermaily before the first message:
- An account. Create one (there is a free plan). New accounts are reviewed before they can send; you can set everything up in the meantime.
- A verified domain. In Domains, the assistant gives you the DKIM, SPF and DMARC records and checks they are published. You can only send from addresses on that domain or its subdomains.
- An API key for that domain, created in API keys. It starts with
hm_and is shown only once: keep it in your secrets manager or in the environment, never in the repository. The same key is the SMTP password; the username isapikey.
Configuration
SMTP credential
In Credentials → Add credential → SMTP:
SMTP credential (Send Email node)
User apikey
Password hm_your_api_key
Host smtp.hermaily.com
Port 587
SSL/TLS off (STARTTLS is used on 587; turn it on only with port 465)
Disable STARTTLS offAPI credential
For the HTTP Request node, a Header Auth credential with name Authorization and value Bearer hm_... (your key with the word Bearer and a space in front).
The instance's own emails
On self-hosted n8n, its invitations and password resets use these variables:
# The n8n instance's own emails (invitations, password resets)
N8N_EMAIL_MODE=smtp
N8N_SMTP_HOST=smtp.hermaily.com
N8N_SMTP_PORT=587
N8N_SMTP_USER=apikey
N8N_SMTP_PASS=hm_your_api_key
N8N_SMTP_SENDER="Acme automations <n8n@acme.example>"
N8N_SMTP_SSL=falseSend a message
Send Email node
Choose the SMTP credential, set From Email to an address on your verified domain, and fill in To Email, Subject and the body (text, HTML or both). Expressions such as {{ $json.email }} work in every field.
HTTP Request node
HTTP Request node
Method POST
URL https://api.hermaily.com/v1/send
Authentication Generic Credential Type > Header Auth
Name Authorization
Value Bearer hm_your_api_key
Send Body on, JSONWith this JSON body (expressions included):
{
"from": "Acme <hello@acme.example>",
"to": "{{ $json.email }}",
"subject": "Your order {{ $json.order_number }} is on its way",
"text": "Hi {{ $json.first_name }}, your order has shipped.",
"tags": ["n8n-shipping"],
"metadata": { "order_id": "{{ $json.order_id }}" }
}The response, 202, has the message id and its status: keep the id if a later step needs to look up the message. For a newsletter, add "stream": "broadcast" and run one item per recipient (paid plans).
Events and webhooks
Every message gets an id: over the API it comes in the 202 response and over SMTP it comes in the server's reply to the message (250 2.0.0 Ok: queued as <id>). Accepted means queued, not delivered. To know what happened next:
- Dashboard. Messages lists each message with its events: delivered, deferred, bounced, complaint, opened, clicked.
- API.
GET https://api.hermaily.com/v1/messages/{id}returns the current status and every event, oldest first (see looking up a message). - Webhooks. In Webhooks, add your URL (https and public) and the events you want. Hermaily makes one
POSTper event, signed withX-Hermaily-Signature: t=<unix>,v1=<hex>, wherev1isHMAC-SHA256(secret, t + "." + body)over the raw body. Answer any2xxwithin 10 seconds; otherwise it is retried for about a day and a half. Delivery is at least once, so discard duplicates by the eventid. The Test button sends a sample event to check your receiver.
Event types: send, delivery, delivery_delay, bounce, complaint, reject, rendering_failure, open, click and unsubscribe (opens and clicks only with tracking on). Permanent bounces, complaints and unsubscribes are suppressed automatically, so you do not need to keep your own list for that. Payload, fields and signature details are in the webhook documentation.
To start a workflow on an event (a bounce, a complaint), add a Webhook node with method POST, activate the workflow and paste its production URL in Hermaily's Webhooks. Leave the response as immediate, so Hermaily gets its 2xx in time. To check the signature, turn on the node's Raw Body option and add a Code node:
// Code node after a Webhook node with the "Raw Body" option on.
// Self-hosted n8n: allow the module with NODE_FUNCTION_ALLOW_BUILTIN=crypto
const crypto = require("crypto");
const secret = "hmwh_your_webhook_secret";
const item = $input.first();
const raw = await this.helpers.getBinaryDataBuffer(0, "data");
const header = item.json.headers["x-hermaily-signature"] || "";
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const t = Number(parts.t);
const expected = crypto.createHmac("sha256", secret).update(`${t}.`).update(raw).digest("hex");
const ok = Math.abs(Date.now() / 1000 - t) <= 300 && expected === (parts.v1 || "");
if (!ok) throw new Error("Invalid Hermaily signature");
return [{ json: JSON.parse(raw.toString("utf8")) }];Troubleshooting
The errors you are most likely to see, with what they mean. The full list is in errors and limits.
The Send Email node hangs with SSL/TLS on and port 587
SSL/TLS means implicit TLS: on only with port 465. With 587, leave it off and STARTTLS is negotiated on its own (do not turn on Disable STARTTLS).
535 5.7.8: authentication failed
The password must be the whole API key (hm_...), copied without spaces and not revoked. The username can be anything; use apikey. After many failed attempts from the same IP, logins are refused for a few minutes.
401 unauthorized
The key is missing, mistyped or revoked. Send it as Authorization: Bearer hm_... and check that the environment variable is really set where the code runs.
403 forbidden
The account cannot send yet (pending approval, paused, or new terms to accept), the key is restricted to the other stream, the From address is not on the key's domain, or the plan does not include broadcasts. GET https://api.hermaily.com/v1/domain tells you the key's domain, whether it is verified and whether the account can send.
422 validation
Sender domain not verified, empty subject, no recipient, more recipients than the plan allows, an invalid address or base64, or a message that is too large. The message says which; it follows Accept-Language (Spanish by default, so send Accept-Language: en). Code against code, not the text.
Send your first message today
Create the account, verify your domain and paste the key. The free plan is enough to try it.