---
url: /getting-started/mail.md
---
# Mail

Evolve sends mail for a handful of features and applies one safety rule on top: outside live and local development, no message reaches a real recipient. This page covers what is sent, how the mailer is configured, and what happens to a message on each environment.

## What sends mail

| Feature | Recipients | Trigger |
|---|---|---|
| Form submissions (leads) | the form's admin address, else the notification address; optionally a confirmation to the sender | a visitor submits a form |
| Event registrations | the admin address of the form attached to the event, else the notification address, plus a confirmation to the participant | a visitor registers for an event |
| User invitations and magic links | the invited or requesting user | invite sent from the panel, magic link requested on the login screen |
| Health check | failures to the alert address; the daily test mail to `HEALTH_CHECK_EMAIL_RECIPIENT`, else the alert address | the scheduled checks, see [Health Checks](/site/health-checks) |
| Shopify | the customer | abandoned checkout recovery, back in stock notifications |

All of them go through Laravel's mailer, so the configuration and the environment rule below apply to every one of them.

## Addresses&#x20;

The Mail tab of the settings panel keeps five addresses in the [settings store](/panel/settings-store#mailsettings-group-mail). Each field shows the stored value; its placeholder names what an empty field inherits from the `.env`.

| Setting | `.env` fallback | Used for |
|---|---|---|
| Sender name and address | `MAIL_FROM_NAME`, `MAIL_FROM_ADDRESS` | the From of every mail. Never a recipient. |
| Reply-to | `EVOLVE_MAIL_REPLY_TO_ADDRESS` | Reply-To of mails to visitors when the form sets none; unset means the sender. |
| Notification address | `EVOLVE_MAIL_NOTIFICATION_ADDRESS` | internal recipient of new leads and event registrations when the form has no admin address |
| Alert address | `HEALTH_WEBMASTER_ADDRESS` | technical alerts: health check failures, the fallback for the daily test mail |

Who receives a new lead:

1. The form's admin address, when set.
2. Otherwise the notification address.
3. Otherwise nobody: the internal notification is skipped and a warning is logged. The visitor's confirmation still goes out.

Before 2.18 the third case mailed the sender address, which on many sites is a no-reply mailbox nobody reads. Set the notification address on every site where some forms have no admin address. The form list in the panel shows each form's effective recipient, or a "No recipient" badge.

The store is shared by every environment that shares the database. A database copy brings the live addresses to staging, where the mail redirect catches them anyway.

## Configuring the mailer

The Mail tab writes the transport to the `.env` of the running instance:

| Setting | Key | Notes |
|---|---|---|
| Mailer | `MAIL_MAILER` | one of the mailers declared in `config/mail.php`, typically `smtp`, `log`, or a provider such as `brevo` |
| SMTP | `MAIL_HOST`, `MAIL_PORT`, `MAIL_SCHEME`, `MAIL_USERNAME`, `MAIL_PASSWORD` | used when the mailer is `smtp` |

Each environment has its own `.env` and its own transport; changing the mailer on the live panel does not touch staging and vice versa. `php artisan evolve:env:diff` shows which keys differ across environments.

The installer seeds a local `.env` with `MAIL_MAILER=smtp`, host `localhost`, port `1025`, which is where Mailpit listens on a Herd or Valet machine. Nothing leaves the machine.

## What happens per environment

The environment type (`EVOLVE_ENV_TYPE`, or inferred from `APP_ENV` when unset, see [Environments](/getting-started/environments#the-environment-in-the-settings-panel)) sets the default:

| Type | Outgoing mail |
|---|---|
| live | delivered to the real recipients |
| staging | every message is redirected to `EVOLVE_MAIL_REDIRECT`, until a developer switches the site to real recipients in the Developers tab |
| development | delivered as configured, normally into Mailpit or the `log` mailer |

The redirect happens at send time, in a `MessageSending` listener, so it covers queued mail, notifications and module mailables alike. The message keeps its subject and body; To, Cc and Bcc are replaced by the single redirect address, and the original recipients are preserved in an `X-Original-To` header. Every redirect writes an info line to the log.

Three details worth knowing:

1. `EVOLVE_MAIL_REDIRECT` defaults to `dev@racerfish.com`. Set it per project if the redirected mail should land somewhere else.
2. If a protected environment has an empty `EVOLVE_MAIL_REDIRECT`, the message is cancelled and a warning is logged. Nothing is sent.
3. `EVOLVE_MAIL_SAFETY` overrides the type in both directions: `false` lets a staging site send real mail for a dress rehearsal, `true` catches mail on a live or development site. Unset means the type decides.

A developer sets all of this in the Developers tab of the panel (Mail safety card); admins configure how mail is sent in the Mail tab, the type and the developer decide to whom.

## Verifying delivery

The mailer health check probes the transport every hour and sends one real test mail a day to `HEALTH_CHECK_EMAIL_RECIPIENT`, falling back to the alert address and never to the sender. Its meta lists the sender, notification and alert address with the source of each (`settings` or `config`). On staging the check is subject to the redirect like everything else, so the test message lands at `EVOLVE_MAIL_REDIRECT`, not at the recipient configured for the check. Details on [Health Checks](/site/health-checks).
