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

# Email delivery

> Send a sandbox's email for real through your own SendGrid, Elastic Email or SMTP account.

Sandboxes never send email by default. Every `wp_mail()` message is kept in the sandbox's **Email Log** instead, so a test site can't email real people by accident.

When you need real mail, for example to test a signup or upload notification end to end, connect your own email provider once and turn delivery on for the sandboxes that need it. Mail is sent from your provider's servers, on your account, and still appears in the Email Log.

## Connect your provider

1. Go to **Account → Email delivery**.
2. Choose **Elastic Email**, **SendGrid** or **Custom SMTP**.
3. Enter your credentials:
   * **Elastic Email:** your account login email as the username, and an SMTP password or an API key with SMTP access.
   * **SendGrid:** an API key with Mail Send permission. The username is always `apikey`.
   * **Custom SMTP:** the host, port, encryption, username and password from your provider (Postmark, Mailgun, Amazon SES, Brevo and others work this way).
4. Enter a **From email** your provider has verified. Every delivered message is sent from this address. If WordPress sent the message as someone else, replies still go to that address.
5. Select **Save provider**, then **Send test email**. SandyWP sends a test message to your own account address and shows the provider's error if it refuses, such as a wrong key or an unverified sender.

Use a key that can only send mail. Anyone who can run code on a delivering sandbox could read it.

## Turn delivery on for a sandbox

Open the sandbox, select **Site settings**, then the **Email** tab, and switch on **Deliver real email**. Switch it off to go back to capturing only.

A sandbox cloned from a live site may contain real customer addresses. Only turn delivery on where every recipient should really get the mail.

Delivery stays on through a reset or restore. Template launch links and guest sandboxes never deliver mail, and copying a sandbox's files never copies your credentials.

## From an agent or script

| Task | MCP tool | API |
| - | - | - |
| Save your provider | `sandywp_save_email_relay` | `PUT /api/account/email-relay` |
| Send a test email | `sandywp_test_email_relay` | `POST /api/account/email-relay/test` |
| Turn delivery on or off | `sandywp_set_email_delivery` | `PUT /api/app/sites/{id}/email/delivery` |
| Check a sandbox | `sandywp_get_email_delivery` | `GET /api/app/sites/{id}/email/delivery` |

Turning delivery on is one call per sandbox, so an agent can enable it right after creating each test site.

## If your own SMTP plugin is installed

A mail plugin you configure inside the sandbox, such as WP Mail SMTP or FluentSMTP, takes priority over the account provider for that sandbox.


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