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

# Emails Troubleshooting

> Troubleshoot common @qawolf/emails problems, including missing client configuration, stale messages, and inbox wait timeouts.

## `mail.inbox()` Throws Because No Client Is Configured

Cause: The runtime did not call `configureEmailsClient(...)` before the flow ran.

Check:

* the runner creates the client
* the runner configures it before flow execution

## `waitForMessage(...)` Returns An Older Message

Check:

* whether the flow should pass `after: new Date()`
* whether the same inbox is being reused across multiple steps or retries

## No Message Arrives Before Timeout

Check:

* the product under test actually sent the email
* the address being used is allowed for the workspace
* the timeout is long enough for the expected delivery path

## Old emails are matched by waitForMessage

Where possible, use `new: true` to generate a unique address for each run. This ensures `waitForMessage` only sees messages from the current run.

If you must reuse a stable address, pass `after: new Date()` immediately before the action that triggers the email:

```javascript theme={null}
const after = new Date();
await page.getByRole("button", { name: "Send code" }).click();

const message = await inbox.waitForMessage({ after });
```

If neither option is available and you are running a local harness, call `resetEmailsClient()` between test suites to clear the client state.
