> 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

DoesQA gives each Test Case an inbox. Your Flow can enter that address in the application, wait for the message, open it, and continue the journey from a link or code inside the email.

```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`](/values/built-in-values.md)         | Test Case | The email belongs to this Test Case, such as registration or password reset |
| [`$testEmailShort`](/values/built-in-values.md)    | Test Case | You need the same Test Case inbox with a shorter address                    |
| [`$accountEmail`](/values/built-in-values.md)      | Account   | Several Test Cases share one mailbox                                        |
| [`$accountEmailShort`](/values/built-in-values.md) | Account   | You need the shared Account inbox with a shorter address                    |

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

[`$randomEmail`](/values/built-in-values.md) is a generated address outside DoesQA mailboxes. Use a DoesQA [Value](/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`](/values/built-in-values.md) with [**Set value**](/test-steps/action/set-value.md).

<figure><img src="https://app.does.qa/screenshots/node/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](/guides/test-registration-and-email-verification.md) and [Test a forgotten-password flow](/guides/test-a-forgotten-password-flow.md).
{% endstep %}

{% step %}

## Wait for the email

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

<figure><img src="https://app.does.qa/screenshots/node/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**](/test-steps/mail/open-email.md).

<figure><img src="https://app.does.qa/screenshots/node/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**](/test-steps/mail/open-email.md), the message body is the active page. Use normal [Action](/test-steps/action.md) and [Check](/test-steps/check.md) Test Steps to click a link, assert text, or store a code into the [Value Store](/values/value-store.md).

<figure><img src="https://app.does.qa/screenshots/node/action_touch_single.png" alt="Touch Test Step"><figcaption><p>Touch</p></figcaption></figure>

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

<figure><img src="https://app.does.qa/screenshots/node/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 are building the Flow.
{% endhint %}

## The finished Flow

![Set value, Wait for email, Open email, Touch, and Close inbox connected as a simple Flow](/files/YskLfGyI8S1g8WlvvGem)

## 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**](/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

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