Verification feature

Turn an incoming verification email into a bounded tool result.

Wait for the right message, extract the likely code, and return the value the workflow needs without granting broad access to a human inbox.

Maintained by Evidence checked Editorial method

Read code extraction docs
Direct answer

mails0 can wait for inbound messages and extract likely 4-8 character verification codes from email subjects and bodies through the CLI, HTTP API, Python SDK, or MCP server. The current parser covers common English, Chinese, Japanese, and Korean code patterns and includes guards against date-like false positives.

Visual guide

Decision map

Verification automation is more than reading the latest email

  1. 01
    Use an isolated mailbox

    A fresh mailbox keeps prior messages out of the search space and prevents a test from consuming another workflow's code.

  2. 02
    Wait with a real timeout

    The caller should fail clearly when the message does not arrive. Infinite polling hides delivery and routing problems.

  3. 03
    Extract with context

    Keyword and delimiter patterns narrow the candidate code, while date rejection reduces common false positives.

The actual job

Verification automation is more than reading the latest email

A reliable agent must bind the correct mailbox, wait within a deadline, identify the intended message, and return a value without confusing a date, order number, or stale code for the verification token.

Identity

Use an isolated mailbox

A fresh mailbox keeps prior messages out of the search space and prevents a test from consuming another workflow's code.

Time

Wait with a real timeout

The caller should fail clearly when the message does not arrive. Infinite polling hides delivery and routing problems.

Parsing

Extract with context

Keyword and delimiter patterns narrow the candidate code, while date rejection reduces common false positives.

Implementation

A complete OTP retrieval loop

  1. 01

    Create or bind the mailbox

    Bootstrap a temporary address for the test or load a mailbox-scoped key for a persistent agent.

  2. 02

    Trigger the external email

    Use the mailbox address in the account creation, login, password reset, or confirmation flow.

  3. 03

    Wait for a matching code

    Call mails code or the equivalent SDK or MCP method with the intended recipient and an explicit timeout.

  4. 04

    Use the code once

    Submit the value, assert the verified state, and delete or expire the mailbox when the workflow is disposable.

Wait for a code
mails code --to [email protected] --timeout 60
Reliability

Failure modes worth testing explicitly

Delivery can be delayed, the sending application can use a different recipient, or the message can contain several numeric strings. The correct behavior is a visible timeout or an auditable match, not a guessed value.

Retries also need idempotency. A browser test may request two codes, making the first one stale. Query by recipient, direction, timing, and sender context when the upstream product makes those fields available.

  • No message arrives before the timeout.
  • The latest message contains a date and a separate verification code.
  • Two codes arrive and only the newest remains valid.
  • The message is in a non-English template.
  • The agent is bound to the wrong mailbox or an expired provisional key.
Choose an interface

Use the interface already native to the agent

RuntimeRecommended surfaceTypical assertion
Shell or coding agentmails codeCommand exits with the expected code before timeout.
MCP-compatible assistantwait_for_code toolTool returns a code from the scoped mailbox.
Python test suitePython SDKAwait a code and compare it with the UI state.
Browser automationCLI or HTTP beside PlaywrightFill the code, then assert verified navigation or UI.
Custom serviceHTTP API and webhookRecord message identity and process the code in application logic.
Evidence

Sources and product scope

Product behavior is verified against the mails0 source and documentation. External comparisons link to official vendor documentation checked on 2026-08-15.

Questions and answers

Questions about Verification-code extraction

Does mails0 read verification codes from the subject and body?

Yes. Code extraction checks message subject and body content for common verification patterns and can be used through CLI, API, Python, or MCP.

Can it extract alphanumeric codes?

Yes. The parser supports common 4-8 character numeric and alphanumeric verification values when they appear in recognized code contexts.

Should I reuse one inbox across every test?

Usually no. Isolate inboxes by test boundary or clean messages deliberately so a stale code cannot satisfy a later test.

What should happen when no code arrives?

The operation should stop at a bounded timeout and expose the failure. Do not silently guess a code or continue the browser flow.

Start with a bounded inbox

Give the agent an inbox, then prove the workflow.

Start with a receive-only temporary mailbox. Move to a permanent identity or self-hosted deployment only after the workflow reaches a real email value event.

Read code extraction docs