# The journey of an email

> Follow one WordPress email through BooleanSMTP — simulation check, connection choice, API or SMTP, logs — and what happens when a send fails.

Every email your WordPress site sends — a contact form, a password reset, an order receipt — starts with the WordPress
function `wp_mail()`. BooleanSMTP takes over at that point and decides, in a fixed order, whether and how the message is sent.

## The normal path

1. **Simulation check.** If **Email Simulation Mode** is on, the message is recorded and goes no further.
2. **The connection is chosen.** A connection the sending code asked for comes first; then the connection that owns the From address; then your **Default Connection** — or, if none is set, your primary
   connection. If there is no connection at all, WordPress's own PHP mail sends it.
3. **It is sent.** Amazon SES, Google Workspace and Microsoft Outlook connections in API mode send over the provider's API;
   every other connection sends over SMTP.
4. **It is logged.** **Email Logs** records it as **Successful** once the provider accepts it.

## When the provider fails

If the provider refuses the message or cannot be reached, BooleanSMTP tries once more on your **Fallback Connection**,
straight away. If that fails too and **Retry on other connections** is on (it is by default), the message waits in a queue
and is retried on your other active connections — after about a minute, then after five — up to two retries. When nothing is
left to try, the log entry is marked **Failed** and your alert channels are notified.

## Step through it

Choose a scenario, then press **Play**, or step with **Previous** and **Next**.

<EmailJourney nodes={nodes} scenarios={scenarios} label="The journey of an email through BooleanSMTP" />

<CheckYourself
	page="how-sending-works"
	questions={[
		{
			question: 'Email Simulation Mode is on. Which connection sends the email?',
			answers: [
				{ label: 'The Default Connection', explain: 'Simulation stops the message before any connection is chosen.' },
				{ label: 'None — it is recorded, not sent', correct: true, explain: 'The message is logged under Simulated and never reaches a provider.' },
				{ label: 'PHP mail', explain: 'PHP mail is used only when there is no connection at all — and simulation stops the message even before that.' },
			],
		},
		{
			question: 'Your provider rejects a message and a Fallback Connection is set. What happens first?',
			answers: [
				{ label: 'An alert is sent', explain: 'Alerts come last, when nothing is left to try.' },
				{ label: 'It is retried once on the fallback connection, straight away', correct: true, explain: 'The fallback gets one immediate try; the retry queue comes after that.' },
				{ label: 'It waits 15 minutes', explain: 'The queue retries after about 1 minute, then 5 — and only after the immediate fallback try.' },
			],
		},
	]}
/>
