---
title: "Email (IMAP/SMTP)"
section: "Integrations"
description: "Set up the SmartestQA Email integration: a test mailbox over IMAP and SMTP, Gmail, Outlook and Yahoo app passwords, custom servers, the connection test and how mail steps use it."
url: https://docs.smartestqa.ai/en/integrations-email.html
audience: [customer, admin]
updated: 2026-11-08
keywords: "email integration imap smtp test mailbox otp one-time code verification link app password gmail outlook office 365 yahoo custom imap mail steps extract otp extract link wait for mail send mail"
---
# Integrations: Email (IMAP/SMTP)

The Email integration gives your tests a mailbox. Mail steps read from it over IMAP to wait for a message, pull out a one-time code or a link, and send over SMTP.

## In short

**On this page you can**

- Connect a Gmail, Outlook / Office 365, Yahoo or custom IMAP mailbox to the project.
- Let mail steps wait for an email and extract a one-time code or a link.
- Send email from a test step through the mailbox’s SMTP server.
- Test IMAP and SMTP separately and see how many emails the folder holds.
- Switch the mailbox off without losing its settings.

**How to use it**

1. Create a dedicated test mailbox and an app password for it.
2. Click Setup , choose the Email Provider , enter address and app password.
3. Click Save & Test and check both IMAP and SMTP succeed.
4. In Automate, add a mail step such as Extract OTP to a test case.
5. Use the output, for example {{tc:otp}} , in the next Type step.

## What it is for

Many flows send an email: sign-up confirmation, password reset, two-factor codes. A test cannot finish such a flow without reading that email. The Email integration connects one mailbox to the project, and the mail steps in **Automate** use it.

| Capability | Mail step | What it does |
| --- | --- | --- |
| **OTP Extraction** | Extract OTP | Finds the newest matching email and stores the code, by default the first six-digit number, in `otp`. |
| **Link Extraction** | Extract Link | Stores the first link of the matching email in `link`. |
| [**Wait for Mail**](https://docs.smartestqa.ai/en/automate-steps-mail.html#wait-for-mail) | Wait for Mail | Waits until a matching email arrives, up to the step’s timeout. |
| **Mail Sending (SMTP)** | Send Mail | Sends an email from the mailbox. |

Usage example shown on the page

```text
1. Click "Register"
2. Type email: test@example.com
3. Click "Send Code"
4. [MailExtractOtp]
   → filterSubject: "Verification"
   → outputVariable: otp
5. Type OTP: {{tc:otp}}
6. Click "Verify"
```

Mail steps only look at **unread** emails that arrived from 30 seconds before the step started. The step settings (timeout, filters, limits) are described in **Automate**.

## Before you start

- **A dedicated mailbox** for tests, never a person’s mailbox. Tests read and mark its emails.
- **IMAP turned on** for that mailbox. Corporate accounts often need IT to allow IMAP.
- **An app password.** Your normal password usually does not work.

  - Gmail: turn on two-step verification, then create an app password at [Google account › App passwords](https://myaccount.google.com/apppasswords).
  - Outlook: create an app password in the account’s security settings ([Microsoft account › App passwords](https://account.live.com/proofs/AppPassword)).
  - Yahoo: create an app password in Yahoo security settings.
  - Custom IMAP: get the server names from your mail admin. IMAP usually uses port 993 (SSL), SMTP 587 (TLS) or 465 (SSL).
- **Network.** [Mail steps](https://docs.smartestqa.ai/en/automate-steps-mail.html) connect from where the test runs. A run on the server cannot reach a mail server that is only inside your network; run those tests on [an agent](https://docs.smartestqa.ai/en/agent-pool-agents.html) inside it.

## Set up the mailbox

1. **Open the dialog**

   Go to **Integrations** › **Email (IMAP/SMTP)** and click **Setup** (or **Configure Now**). The **Add Email Integration** dialog opens.
2. **Mailbox**

   Enter an **Integration Name** (for example `QA Gmail Account`), pick the **Email Provider**: Gmail, Outlook / Office 365, Yahoo Mail or Custom IMAP. Enter the **Email Address** and the app password.
3. **Server Settings**

   For Gmail, Outlook and Yahoo the servers are **Auto-filled**. For Custom IMAP the section opens: **IMAP Server** and **Port** with SSL (for reading mail), **SMTP Server** and **Port** with TLS (for sending mail).
4. **Other Settings**

   **Default Folder** (`INBOX`), **Poll Interval (sec)** (30), **Max Email Count** (50) and **Active**. Defaults suit most tests.
5. **Save & Test**

   Click **Save & Test**. SmartestQA saves, then opens the folder over IMAP and logs in to SMTP.

   “All connections successful”, with “IMAP connection successful (*n* mail)” and “SMTP connection successful”. Click **Save** to close.

## The Email page

- ****Connection Status****: [**Integration Active**](https://docs.smartestqa.ai/en/integrations.html#concepts), **Email Address**, **Email Provider**, **IMAP Server**, **SMTP Server**.
- ****Test Connection****: runs the IMAP and SMTP test again and shows both results.
- **Last test**: comes from the last saved test. It is OK when IMAP worked; an IMAP failure shows the error.
- ****Capabilities****, ****Usage Example**** and ****Supported Action Types:****: Mail Extract [OTP](https://docs.smartestqa.ai/en/automate-steps-mail.html#extract-otp), Mail Extract Link, Mail Wait For, Mail Send.
- ****Setup Guide****: short steps for Gmail, Outlook and custom IMAP.

The app password is stored encrypted. When you edit the settings, “Leave blank if you don't want to change it” applies. Integration names must be unique in the project.

## For AI assistants

An assistant connected through [MCP](https://docs.smartestqa.ai/en/mcp.html) reads the test mailbox with `smartest_integrations` (system `mail`, actions `messages`, `wait`, `otp` and `link`), for example to check that a reset email arrived while it writes a test. The mailbox itself is set up only on this page.

## If something goes wrong

- [“IMAP connection failed: …”](https://docs.smartestqa.ai/en/integrations-troubleshooting.html#fix-mail-imap)
- [“SMTP connection failed: …” / “Some connections failed”](https://docs.smartestqa.ai/en/integrations-troubleshooting.html#fix-mail-smtp)
- [“Mail integration with this name already exists”](https://docs.smartestqa.ai/en/integrations-troubleshooting.html#fix-mail-name)
- [A mail step finds no email](https://docs.smartestqa.ai/en/integrations-troubleshooting.html#fix-mail-no-otp)
