# Email Sending: SMTP and HTTP API

> The SMTP server and ports, the HTTP send endpoint and its fields, and the DNS records for your sending domain.

Source: https://docs.phluit.com/reference/email-sending-api/

Send transactional email from your app over SMTP or a simple HTTP API. Keys are created on the **Keys** tab of the **Email** page in the portal, and each key is shown only once.

## SMTP

| Setting | Value |
|---|---|
| Server | `postal20.phluit.net` |
| Port | `587` (or `25`) with STARTTLS |
| Username | Shown under **How to send** on the **Overview** tab |
| Password | Your SMTP key |

Works with Laravel, Rails, Django, Node.js (nodemailer), PHP, WordPress SMTP plugins and any tool that sends over SMTP.

## HTTP API

`POST https://postal20.phluit.net/api/v1/send/message` with the header `X-Server-API-Key: <your API key>` and a JSON body.

| Field | |
|---|---|
| `from` | Required. An address on your verified sending domain. |
| `to` | Required. One or more recipients. |
| `subject` | Required. |
| `plain_body` or `html_body` | Required: at least one of them. |
| `cc`, `bcc`, `reply_to` | Optional. |
| `tag` | Optional, to find messages in the activity log. |
| `attachments` | Optional. |

```sh
curl https://postal20.phluit.net/api/v1/send/message \
  -H "X-Server-API-Key: YOUR-API-KEY" \
  -H "Content-Type: application/json" \
  -d '{"from":"app@mail.example.com","to":["customer@example.org"],"subject":"Your sign-in code","plain_body":"Your code is 123456"}'
```

## DNS records for your sending domain

Add the domain on the **Domains** tab (a subdomain such as `mail.example.com` is recommended), create the four records shown, then click **Check DNS**. The domain can send as soon as its DKIM record is found.

| Record | Type | |
|---|---|---|
| SPF | TXT | |
| DKIM | TXT | Required |
| Return path | CNAME | Receives bounces |
| DMARC | TXT | Recommended |

## Limits

- Each plan has a monthly and an hourly limit; see [plans and prices](/products/email-sending/plans-and-prices/). Mail over the hourly limit is held, not billed.
- For the first 30 days after approval the hourly limit is half the plan's.
- Sending is paused for review when more than 5% of messages bounce in 24 hours (after at least 50 sent), when several messages are flagged as spam in a day, or when newsletter-style mail goes to many recipients.
- Only transactional email may be sent: no newsletters, promotions or cold email.

See also: [Email Sending guides](/products/email-sending/).
