> For the complete documentation index, see [llms.txt](https://docs.does.qa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.does.qa/guides/interacting-with-emails.md).

# Interacting with emails

Use DoesQA inboxes and Mail Test Steps to test registration, password reset, and other email journeys.

DoesQA includes test inboxes and [Mail Test Steps](https://docs.does.qa/test-steps/mail.md) for journeys that send email. Your Flow can enter a DoesQA address in the application, wait for the message, open it, and continue from a link or code inside the email.

For the full picture on inbox types, parallel isolation, and common journeys, see [Email testing in DoesQA](https://docs.does.qa/guides/email-testing-in-doesqa.md).

```mermaid
flowchart TD
  enter["Set value with $testEmail"] --> wait["Wait for email"]
  wait --> openMail["Open email"]
  openMail --> act["Touch or Check in the message"]
  act --> close["Close inbox"]
```

Use the **Flow Builder** for this walkthrough.

## Choose the address and inbox

| Value                                                                  | Inbox     | Use it when                                                                 |
| ---------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------- |
| [`$testEmail`](https://docs.does.qa/values/built-in-values.md)         | Test Case | The email belongs to this Test Case, such as registration or password reset |
| [`$testEmailShort`](https://docs.does.qa/values/built-in-values.md)    | Test Case | You need the same Test Case inbox with a shorter address                    |
| [`$accountEmail`](https://docs.does.qa/values/built-in-values.md)      | Account   | Several Test Cases share one mailbox                                        |
| [`$accountEmailShort`](https://docs.does.qa/values/built-in-values.md) | Account   | You need the shared Account inbox with a shorter address                    |

Prefer [`$testEmail`](https://docs.does.qa/values/built-in-values.md) with the **Test Case** inbox for journeys that send one email to one test. Use [`$accountEmail`](https://docs.does.qa/values/built-in-values.md) only when you deliberately want a shared mailbox.

[`$randomEmail`](https://docs.does.qa/values/built-in-values.md) is a generated address outside DoesQA mailboxes. Use a DoesQA [Value](https://docs.does.qa/values/value-store.md) when the Flow will wait for or open the message.

## Build the Flow

{% stepper %}
{% step %}

## Enter the DoesQA address

In the step that fills the application's email field, use [`$testEmail`](https://docs.does.qa/values/built-in-values.md) with [**Set value**](https://docs.does.qa/test-steps/action/set-value.md).

<figure><img src="https://static.does.qa/assets/nodes/action_input_setValue.png" alt="Set value Test Step"><figcaption><p>Set value</p></figcaption></figure>

That sends the application to the Test Case inbox for this Run.
{% endstep %}

{% step %}

## Trigger the email

Continue the journey until the application should send the message, such as submitting registration or requesting a password reset. For full walkthroughs, see [Test registration and email verification](https://docs.does.qa/guides/test-registration-and-email-verification.md) and [Test a forgotten-password flow](https://docs.does.qa/guides/test-a-forgotten-password-flow.md).
{% endstep %}

{% step %}

## Wait for the email

Add [**Wait for email**](https://docs.does.qa/test-steps/mail/wait-for-email.md) from the [**Mail**](https://docs.does.qa/test-steps/mail.md) family.

<figure><img src="https://static.does.qa/assets/nodes/mail_wait_forMessage.png" alt="Wait for email Test Step"><figcaption><p>Wait for email</p></figcaption></figure>

1. Set **Inbox** to **Test Case**.
2. Leave **Type** as **New** when any new message is enough.
3. Or set **Type** to **Custom**, choose **Subject** or **From**, and match wording your application actually sends.
4. In advanced settings, check **End Offset**. The default is five minutes. Raise it when the application usually takes longer to send.
   {% endstep %}

{% step %}

## Open the email

Add [**Open email**](https://docs.does.qa/test-steps/mail/open-email.md).

<figure><img src="https://static.does.qa/assets/nodes/mail_message_open.png" alt="Open email Test Step"><figcaption><p>Open email</p></figcaption></figure>

1. Set **Inbox** to **Test Case**.
2. Choose **Latest** for the newest matching message, or **Custom** with **Subject** or **From** when you need a specific one.
   {% endstep %}

{% step %}

## Continue from the message

After [**Open email**](https://docs.does.qa/test-steps/mail/open-email.md), the message body is the active page. Use normal [Action](https://docs.does.qa/test-steps/action.md), [Check](https://docs.does.qa/test-steps/check.md), and [Validator](https://docs.does.qa/test-steps/validator.md) Test Steps to click a link, assert text, run [accessibility checks](https://docs.does.qa/better-coverage/add-accessibility-checks.md) on the message, or store a code into the [Value Store](https://docs.does.qa/values/value-store.md).

<figure><img src="https://static.does.qa/assets/nodes/action_touch_single.png" alt="Touch Test Step"><figcaption><p>Touch</p></figcaption></figure>

When you are finished with the message, add [**Close inbox**](https://docs.does.qa/test-steps/mail/close-inbox.md) to return to the application window.

<figure><img src="https://static.does.qa/assets/nodes/mail_inbox_close.png" alt="Close inbox Test Step"><figcaption><p>Close inbox</p></figcaption></figure>
{% endstep %}
{% endstepper %}

{% hint style="info" %}
**Pro tip:** Open **Mail** in the left navigation to inspect the Account inbox or a Test Case inbox while you build the Flow, or after a Run to review messages that arrived during the test.
{% endhint %}

## The finished Flow

![Set value, Wait for email, Open email, Touch, and Close inbox connected as a simple Flow](https://2973996442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH10EEO19EDpBHNPowThh%2Fuploads%2Fgit-blob-41bad466a6ae4a4c883f4a92bdf4bc3b6f014261%2Femail-flow-approx.png?alt=media)

## Match the right message

| Setting          | What it does                                                                                                               |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **Type: New**    | Waits for any email that arrives in the time window                                                                        |
| **Type: Custom** | Waits until **Subject**, **From**, or another property matches your Value                                                  |
| **End Offset**   | How long [**Wait for email**](https://docs.does.qa/test-steps/mail/wait-for-email.md) keeps checking, up to twenty minutes |
| **Start Offset** | How far back the wait looks, such as from Test Start                                                                       |

Use **Subject** or **From** filters when the inbox may receive more than one message. Keep the comparison close to the real email text.

## Related

* [Email testing in DoesQA](https://docs.does.qa/guides/email-testing-in-doesqa.md)
* [Test passwordless login](https://docs.does.qa/guides/test-passwordless-login.md)
* [Test a forgotten-password flow](https://docs.does.qa/guides/test-a-forgotten-password-flow.md)
* [Test registration and email verification](https://docs.does.qa/guides/test-registration-and-email-verification.md)
* [Mail Test Steps](https://docs.does.qa/test-steps/mail.md)
* [Wait For Email](https://docs.does.qa/test-steps/mail/wait-for-email.md)
* [Open Email](https://docs.does.qa/test-steps/mail/open-email.md)
* [Close Inbox](https://docs.does.qa/test-steps/mail/close-inbox.md)
* [Set Value](https://docs.does.qa/test-steps/action/set-value.md)
* [Built-in Values](https://docs.does.qa/values/built-in-values.md)
* [Value Store](https://docs.does.qa/values/value-store.md)
