> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pocketflows.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send a single email

> Send one email from a business to one recipient, for a test or a demo

This guide sends one email from a business to one customer: the quickest way to see your integration
deliver something. To send to many customers, use a campaign or a trigger.

You need a business and a customer with an email address. If you don't have them yet, follow
[Sync businesses and customers](https://docs.pocketflows.com/how-to/sync-businesses-and-customers.md) first.

## 1. Get an address to send from

Find the business's email addresses and their IDs, which start with `ea_`:

```
GET /businesses/:business_id/email_addresses
```

* **In test mode,** each new business gets a test address at `dev.pflowsemail.com` automatically, so
  you can send straight away.
* **In live mode,** emails come from the business's own domain. Set up the domain and create an
  address on it by following [Set up custom domains](https://docs.pocketflows.com/how-to/set-up-custom-domains.md). DNS changes can
  take up to 48 hours, so start this early.

An address on a custom domain can't send until the domain is validated. Sending from it before then
returns `422`.

## 2. Create a template

Create a template with a `name`, a `subject` and the email's HTML. Both the subject and the HTML can
use [personalization variables](https://docs.pocketflows.com/concepts/personalization-variables.md):

```
POST /businesses/:business_id/email_templates

Body
{
  "name": "Integration test",
  "subject": "Hello from {{ business.name }}",
  "template_html": "<p>Hi {{ customer.first_name }}, this is a test from {{ business.name }}.</p>"
}
```

The response includes the template's `id`.

## 3. Send it

Send the template to the customer, from the address you chose:

```
POST /email_templates/:id/send

Body
{
  "from": "ea_...",
  "customer": "cust_..."
}
```

The email is sent before the request returns. The response is the sent email, with `ok` set to
`true`. If the email can't be sent, the request fails with `422` and the reason in `errors`, for
example a personalization variable without a value.

To send to an address that isn't a customer, pass `to` in place of `customer`. The template then has
no customer data, so pass any values it uses in `variables`:

```
POST /email_templates/:id/send

Body
{
  "from": "ea_...",
  "to": "you@example.com",
  "variables": {
    "customer": { "first_name": "Sam" }
  }
}
```

## Things to know

* **It's meant for tests and one-offs.** Each business can send 100 emails this way in any 24 hours.
  Past that, the request returns `429`.
* **It doesn't check consent.** The email goes to the recipient even if they unsubscribed. See
  [Respect customer consent](https://docs.pocketflows.com/how-to/manage-customer-consent.md).
* **Test mode still delivers.** Send to an address you control.
* **Retries.** Send an [idempotency key](https://docs.pocketflows.com/reference/idempotency-keys.md) so a retried request doesn't send
  the email twice.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.