Envello
n8n guide

Send email from n8n

Send transactional email from an n8n workflow through Envello's API: Header Auth credential, a JSON body that survives quotes in user data, idempotency for retries, and batch sends.

Updated · 3 min read

n8n doesn't need a dedicated node to send through Envello. The API is one authenticated POST with a JSON body, which is exactly what the built-in HTTP Request node does. This guide builds a workflow that receives an order event on a Webhook trigger and sends a confirmation email, then covers retries, errors and sending to many people at once.

Envello's SMTP relay isn't live yet, so n8n's Send Email (SMTP) node isn't an option today. The HTTP route also gives you the email id back, which the SMTP node doesn't.

1. Store the API key as a credential

In n8n, create a credential of type Header Auth. Name: Authorization. Value: Bearer env_live_... (the word Bearer, a space, then your key). Use a sending-access key: it can send email and nothing else, so a leaked workflow export can't touch your domains or logs.

Keeping the key in a credential rather than typing it into the node means it isn't stored in the workflow JSON when you export or share the workflow.

2. Add the HTTP Request node

After your trigger, add an HTTP Request node and set it up like this:

  • Method: POST
  • URL: https://api.envello.dev/emails
  • Authentication: Generic Credential Type, then Generic Auth Type: Header Auth, and pick the credential from step 1
  • Send Headers: on. Add Idempotency-Key with the value order-{{ $json.body.orderId }}-confirmation
  • Send Body: on. Body Content Type: JSON. Specify Body: Using JSON
  • JSON: the body below, with the field switched to Expression
{
  "from": "Acme <[email protected]>",
  "to": {{ JSON.stringify($json.body.email) }},
  "subject": {{ JSON.stringify("Order " + $json.body.orderId + " is confirmed") }},
  "html": {{ JSON.stringify("<p>Hi " + $json.body.name + ", thanks for your order.</p>") }},
  "tags": [
    { "name": "source", "value": "n8n" },
    { "name": "workflow", "value": "order_confirmation" }
  ]
}

Why JSON.stringify around every dynamic value

Writing "to": "{{ $json.body.email }}" works until a customer's name contains a quote or a line break, and then the body stops being valid JSON and the request fails. JSON.stringify() adds the quotes and escapes whatever is inside, so O'Brien or a pasted multi-line address can't break the request.

The from address must be on a domain you've verified in Envello. Tag names and values only allow letters, digits, _ and -, so use order_confirmation, not "order confirmation".

3. Test it

With the workflow open, click Listen for test event on the Webhook node and send a sample request to its test URL. Use an env_test_ key in a second credential while you build: Envello accepts and logs test-mode emails without delivering them.

curl -X POST https://your-n8n.example.com/webhook-test/order-confirmed \
  -H "Content-Type: application/json" \
  -d '{ "email": "[email protected]", "name": "Sam", "orderId": "1042" }'

Retries without duplicate emails

Turn on Retry On Fail in the HTTP Request node's settings so a network blip or a 429 doesn't drop the email. Retries resend the same request, so the Idempotency-Key header matters: Envello sees the same key within 24 hours and returns the original result instead of sending a second email.

Build the key from your data (order id plus email type), not from something that changes per run, such as $now. The key accepts letters, digits and . _ : - up to 255 characters.

Handle errors on purpose

Set On Error to Continue (using error output) so a failed send goes down a second branch instead of stopping the workflow. Route that branch to whatever you already use for alerts. Then check the status code: 400 means the body didn't validate (the response lists the fields), 403 usually means the from domain isn't verified, and 422 means Envello refused the recipient, for example because the address is suppressed after an earlier bounce. None of these succeed on retry, so don't retry them.

Sending to many people at once

For a list of recipients, don't run one request per item. POST /emails/batch takes up to 100 complete emails and returns a result per email. Point a second HTTP Request node at https://api.envello.dev/emails/batch, set Execute Once in its settings so it runs a single time for all incoming items, and build the body from every item. Leave Retry On Fail off on this node: the batch endpoint doesn't take an Idempotency-Key, so a retry after a timeout could send the whole batch twice. Read the per-email results instead and resend only the failed ones.

{{ JSON.stringify({
  emails: $input.all().map((item) => ({
    from: "Acme <[email protected]>",
    to: item.json.email,
    subject: "Your weekly usage report",
    html: item.json.reportHtml,
  })),
}) }}

Reacting to bounces in n8n

Envello can post delivery events (delivered, bounced, complained, opened, clicked) to a webhook URL, and an n8n Webhook node can receive them. Each request carries an Envello-Signature header, an HMAC-SHA256 over the timestamp and the raw body. Check it before trusting the event: the webhook signature guide has the exact scheme and working verification code.

Free tool

Check your domain's SPF, DKIM, and DMARC records

Paste in a domain and see what's missing, plus the exact DNS records to fix it. Free, no account needed.

Check your domain →