# Send emails with n8n and MailBlastr

> Use the MailBlastr HTTP Request node in n8n to send email, plus a webhook trigger node to start workflows on delivery, bounce, and other email events.

[n8n](https://n8n.io) is a workflow automation platform that connects apps and builds automations with little or no code. You can call MailBlastr from n8n with its built-in **HTTP Request** node to send email, and start workflows from MailBlastr [webhook events](https://www.mailblastr.com/docs/webhooks/overview) with a **Webhook** trigger node — delivered, opened, bounced, and more.

## Before you start

- [Create an API key](https://www.mailblastr.com/docs/api/api-keys-create) and copy it — a `sending_access` key is enough to send.
- Verify a [domain](https://www.mailblastr.com/docs/domains/managing) so you can send to addresses other than your own.

## Send an email from a workflow

Add an **HTTP Request** node and configure it to call `POST ${BASE}/emails`:

1. **Add an HTTP Request node** — On the canvas, add an HTTP Request node after your trigger.
2. **Set method and URL** — Method POST, URL https://api.mailblastr.com/emails.
3. **Add authentication** — Add a header Authorization with value Bearer mb_xxxxxxxxx (store the key in an n8n credential rather than inline).
4. **Send JSON body** — Set the body to JSON with from, to, subject, and html fields. Map values from earlier nodes with n8n expressions.
5. **Execute** — Run the node; a 200 response with an email id means it was accepted.

A minimal body for the node:

```json
{
  "from": "Acme <hello@yourdomain.com>",
  "to": ["customer@example.com"],
  "subject": "Hello from n8n",
  "html": "<p>Sent from an n8n workflow.</p>"
}
```

> **Note:** Store the API key as an n8n **Header Auth** credential (header `Authorization`, value `Bearer mb_xxxxxxxxx`) and reference it from the node, so the key is not saved in the workflow JSON.

## Trigger a workflow on email events

To start a workflow when something happens to your mail, add a **Webhook** trigger node, copy its URL, and register that URL as a [webhook endpoint](https://www.mailblastr.com/docs/webhooks/overview) in MailBlastr — subscribing to the events you care about. Verify the [signature](https://www.mailblastr.com/docs/webhooks/verify) (the `svix-*` headers and your `whsec_` secret) before acting on a payload.

Events you can trigger on include:

| Event | Fires when |
| --- | --- |
| `email.sent` | The email was accepted and sent. |
| `email.delivered` | The email was delivered to the recipient. |
| `email.bounced` | The email bounced. |
| `email.complained` | A spam complaint was received. |
| `email.opened` | The recipient opened the email. |
| `email.clicked` | A link in the email was clicked. |
| `email.received` | An inbound email was received (see [Receiving](https://www.mailblastr.com/docs/kb/receive-emails)). |
| `contact.created` | A new contact was added. |

## Example: welcome email on new contact

1. **Webhook trigger** — listens for `contact.created`.
2. **HTTP Request** — sends a welcome email to the new contact, mapping the address from the trigger payload.

The trigger-then-act pattern works for any event — notify Slack on a bounce, or log delivery events to a sheet. See the full [emails API](https://www.mailblastr.com/docs/api/emails-send) and [webhooks overview](https://www.mailblastr.com/docs/webhooks/overview).
