# SMTP

> Send email through MailBlastr over SMTP using your API key as the password.

If your application or platform already speaks SMTP, you can send through MailBlastr without touching the HTTP API. Point your SMTP client at the MailBlastr relay and authenticate with your API key. Emails sent over SMTP appear in your dashboard and event log just like API sends.

## Prerequisites

- A MailBlastr [API key](https://www.mailblastr.com/docs/api-keys/overview).
- A [verified domain](https://www.mailblastr.com/docs/domains/managing) to send from.

## SMTP credentials

Configure your SMTP integration with the following credentials:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Host` | string | No | `smtp.mailblastr.com` |
| `Port` | number | No | `25`, `465`, `587`, `2465`, or `2587`. |
| `Username` | string | No | `mailblastr` |
| `Password` | string | No | Your API key, e.g. `mb_xxxxxxxxx`. |

## Ports and security

The port you choose determines how the connection is secured:

| Type | Port | Security |
| --- | --- | --- |
| SMTPS | `465`, `2465` | Implicit SSL/TLS — connects directly over SSL/TLS. |
| STARTTLS | `25`, `587`, `2587` | Explicit SSL/TLS — connects in plaintext, then upgrades to TLS. |

> **Warning:** Always use a TLS port. Port `587` (STARTTLS) or `465` (SMTPS) are the safe defaults; plain port `25` should only be used when it negotiates STARTTLS.

## Idempotency key

To prevent duplicate emails on retry, add a `Mailblastr-Idempotency-Key` header to the message. MailBlastr processes a given key once and ignores repeats for 24 hours — see [Idempotency keys](https://www.mailblastr.com/docs/emails/idempotency).

**SMTP message**

```yaml
From: Acme <onboarding@yourdomain.com>
To: delivered@example.com
Subject: hello world
Mailblastr-Idempotency-Key: welcome-user/123456789

<p>it works!</p>
```

## Custom headers

If your SMTP client supports it, you can add custom MIME headers to your messages. Common uses:

- Add a correlation ID with a header like `X-Entity-Ref-ID` for downstream filtering.
- For transactional mail, add your own `List-Unsubscribe` header. See [Custom headers](https://www.mailblastr.com/docs/emails/headers) and [Unsubscribe links](https://www.mailblastr.com/docs/emails/unsubscribe).

## FAQ

**Where do I see emails sent over SMTP?** They show up in your emails dashboard and carry the same status and [event log](https://www.mailblastr.com/docs/emails/managing) as API sends.

**Does the rate limit apply to SMTP?** Yes — SMTP sends count against the same account rate limit as the HTTP API.

> **Note:** Prefer the HTTP API for richer control (idempotency replay, scheduling, attachments by URL). SMTP is best when integrating an existing system that only speaks SMTP.
