How AI Agents Verify: Email Codes Without Humans or LLMs
How AI Agents Verify: Email Codes Without Humans or LLMs
Every automated flow eventually hits the same wall: a service sends a 6-digit code to a mailbox, and the agent is left parsing HTML for a string that might be "4 8 2 9 1 0", "482-910", or buried under a paragraph of marketing. The classic workaround is to pipe the email body into an LLM and ask it to "find the verification code" — slow, costly, and brittle. There is a simpler pattern: extract the code on the server, where it belongs.
The pain: an agent stuck at the OTP prompt
Consider what a typical agent-based signup flow looks like today:
1. The agent submits a form.
2. The service emails a one-time code.
3. The agent fetches the inbox, downloads the message, and hands the raw HTML to an LLM: *"What is the 6-digit code in this email?"*
4. The LLM usually gets it right — sometimes. It also charges you for tokens, adds a round-trip of latency, and occasionally returns the code wrapped in prose, a guessed variant, or nothing at all.
5. The agent has to handle the case where no code has arrived yet by re-polling the inbox on its own timer.
Steps 3–5 are where reliability dies. The code is a *deterministic* problem: verification emails follow extremely consistent formats, and the set of formats is well understood (fixed-length numeric codes, spaced digits, dashed groups, confirmation links). Solving it with a general-purpose LLM is like hiring a chef to cut straight lines — it works, but you are paying for creativity you never asked for.
Server-side extraction: a battery, not a prompt
A better design moves extraction out of the agent and onto the mailbox service itself. Nimpost does this with a server-side battery of regular expressions and heuristics that runs against each incoming message before you read it:
- Fixed-length OTPs — 4-, 6-, and 8-digit codes, the three lengths that cover the overwhelming majority of verification flows (4-digit for lower-friction services, 6-digit as the de facto standard, 8-digit for higher-assurance providers).
- Spaced and grouped codes — digits presented as "4 8 2 9 1 0" or "4829 10" are normalized to the bare code so the agent never has to guess formatting.
- Confirmation links — one-click email verification sends a link instead of a code; the extractor returns it as a structured
link, so the agent can navigate it directly instead of regexing an HTML anchor. - Action candidates — buttons or links with meaningful labels (resend, cancel, verify) are surfaced as
actions, giving the agent a structured view of what the email actually offers.
No LLM is involved in the default path: it is pattern matching and heuristics, which means it is fast, cheap, deterministic, and it does not consume a single token. If you genuinely need semantic extraction for a badly non-standard email format, an LLM fallback is available as a paid add-on — but for the overwhelming majority of services, the battery handles it.
The result of a single extraction is a structured payload: the found code (if any), confirmation links, and actions. Your agent consumes JSON, not HTML.
wait_inbox: stop polling, start blocking
Extraction is only half the problem. The other half is timing: the code email often lands a few seconds after the request, and naive code polls the inbox every second or two, burning requests and adding jitter. Nimpost's REST API and MCP toolset include a wait_inbox operation — a long poll of up to 60 seconds. The call returns immediately if a matching email is already there, or holds until one arrives, or times out cleanly with a typed result. One blocking call replaces a loop, and the agent's state machine stays trivial: wait, then verify.
verify_code: one call, one answer
The two halves compose into a single primitive: verify_code. It waits for the email, runs the extraction battery, and returns a flat result:
{ "found": true, "code": "482910", "links": [], "actions": [] }
On a clean timeout, the same shape comes back with found: false — no exception to special-case, no "did it parse?" ambiguity. For an agent, this is the entire OTP problem in one tool call.
Over the MCP server (Streamable HTTP at https://nimpost.com/mcp, crawlable contract at /mcp/manifest.json) the surface is explicit and small: twelve tools covering identity creation, alias management, inbox listing, waiting, reading, extraction, verification, sending, status, retention, and destruction. A code agent does not need to invent protocols; it binds to the tools and moves on.
Where extraction sits in the plans
Extraction is a metered feature, and the tiers are sized around it:
| Capability | Free | Agent ($9/mo) | Swarm ($29/mo) |
|---|---|---|---|
| Aliases | 1 | 25 | 100 |
| Sends / month | 50 | 5,000 | 25,000 |
| Retention | 24 h | 30 d | 90 d |
| Extractions / month | — | 100 | 1,000 |
| Receiving | unlimited, free | unlimited, free | unlimited, free |
| Webhooks + WS + SSE | — | included | included |
| Over-cap sends | — | $2 per 1,000 | $2 per 1,000 |
The Agent tier's 100 extractions per month is enough for a development loop or a modest production flow; Swarm's 1,000 covers multi-agent fleets. Receiving is free and unlimited on every tier, so waiting and reading never cost you anything — only sending and extraction are metered.
Note the economics: an LLM-based extraction costs tokens *and* a round trip *and* a hallucination risk on every single OTP. A server-side extraction is a flat, predictable line item in a plan you are paying for anyway. The deterministic path should be the default; the LLM fallback is for the long tail.
FAQ
Does Nimpost actually use an LLM to find codes?
No. The default path is a server-side battery of regex and heuristics covering 4/6/8-digit codes, spaced digits, confirmation links, and actions. An LLM fallback exists as a paid add-on for formats the battery cannot handle; most verification emails do not need it.
What happens if the email hasn't arrived yet?
wait_inbox blocks for up to 60 seconds (long poll) and returns as soon as a matching email lands. verify_code wraps wait + extract in one call and returns found: false on a clean timeout, so your agent never needs its own retry timer.
Can I verify a 4-digit or 8-digit code, not just 6?
Yes. The extraction battery is tuned for 4-, 6-, and 8-digit OTPs, including spaced and grouped presentations. Confirmation links and action buttons are returned alongside the code in the same structured response.
Is there a human account requirement for the API?
The agent API is keyless — you can call it with no account at all. A human account unlocks the dashboard and billing for metered tiers; receiving stays free either way.
Point your agents at the mailbox
If your agents are stuck at OTP prompts, the fix is to stop making them read mail. Create the alias, long-poll, verify in one call, and burn the address when you are done: the full API lives at https://nimpost.com/docs, the MCP server at https://nimpost.com/mcp, and plans at https://nimpost.com/pricing.
Try it on your agent
Receiving is free on every tier. Start with 1 alias and 50 sends per month — no card needed to receive mail.
Create an agent mailbox Read the API Connect via MCP