# AI agent sign-up and email verification codes

> How an AI agent signs up for an account with its own inbox and reads the verification code, and why a fake sign-in email is held before the agent sees it.

Source: https://trotta.email/use-cases/sign-up-and-verification

An AI agent signs up for an account by giving its own email address, waiting for the verification email, and reading the code or the confirmation link. The risk is a message it cannot tell apart from the real one: a fake sign-in email that asks it to type a password into a form.

Updated November 20, 2026

## How an AI agent signs up for an account by email

An AI agent signs up for an account the way a human does: it gives an email address, then proves the address is its own. With Trotta Mail the code is parsed before the agent reads the message.

1. Give the agent its own inbox. `POST /v1/agents/signup` returns one, with an API key, in one call.
2. Note the time, then let the agent fill in the sign-up form with the inbox address.
3. Wait for the next delivered message that carries a code. The call holds open for up to 60 seconds.
4. Read the code from `extracted.codes`, or the confirmation link from `extracted.verify_links`.

In the code, `mail` is the client from the `trotta-mail` package and `riley` is the agent's inbox.

```typescript
const since = new Date();
await signUp("harbor.example", riley.address); // your agent fills the form
const msg = await mail.inboxes.wait(riley.id, { hasCode: true, after: since });
msg?.extracted.codes[0].value; // "481920". Held mail never reaches wait().
```

MCP:

```json
{
  "name": "wait_for_message",
  "arguments": { "inbox_id": "inb_4x8kq2m9tn7vb3hcd5ze", "has_code": true, "timeout": 60 }
}
```

On a timeout the wait returns no message. Call it again.

## The real verification code and the fake sign-in

The job has two sample messages: a real verification email, which got a `deliver` verdict, and a fake sign-in, which got `hold`. The [verdicts](https://trotta.email/docs/concepts) below are the ones the live engine gave on November 20, 2026.

The real message comes from Harbor at `no-reply@harbor.example`, with the subject "Your Harbor verification code". It carries the code 481920, says the code expires in 10 minutes, and gives a confirmation link on harbor.example.

The fake also says it is from Harbor, but its address is `security@harbor-login.example`. It tells the reader to confirm a password within 24 hours or the account will be locked. Its link reads `https://harbor.example/login` and opens a page on session-verify.example, and the message carries a form with a password field.

| Message | Verdict | Summary, as the engine wrote it |
| --- | --- | --- |
| Verification code from harbor.example | `deliver`, level `safe` | No threats found. |
| Fake sign-in from harbor-login.example | `hold`, level `danger` | The message contains a form that collects what you type. |

The engine read 481920 out of the real message as a one-time code. The fake set four signals, among them "Link text and destination do not match".

## In an inbox that accepts first and checks after

An inbox that accepts mail first and checks after hands both messages to the agent. The agent is waiting for mail from Harbor, and the fake arrives under that name with a link that reads like the real site. An agent that follows it types a password into a stranger's form before any later check runs.

In a Trotta Mail inbox the held message never reaches the wait call. The agent's key sees that a message exists and why it was held, and nothing its sender wrote. A human reads it in the Held folder and releases or discards it.

## Setting up agent sign-ups well

A sign-up agent needs its own inbox, a filtered wait, and a human named for held mail.

- **One inbox per agent.** An agent's own inbox starts with login mail open, because that is where its sign-up codes arrive.
- **No codes from a human's mailbox.** A human's mailbox starts [sealed](https://trotta.email/docs/security): to an API key, mail with a code, a password reset or a sign-in link does not exist there.
- **Filter the wait.** Pass `after` so an old code is never returned, and `from` or `subject` when the agent expects one sender.
- **Name who reviews held mail.** [Held mail](https://trotta.email/learn/held-mail) from every agent inbox goes to a human. Subscribe to `message.held` if the agent should tell someone.
- **No `guard:release` or `mail:full` key for the agent.** Without `guard:release` a key cannot read or release held mail. Without `mail:full` it reads the safe view.

No filter catches everything, so tell the agent to enter codes on the site it signed up on, and never to type a password into a page a message links to.

## Questions

### How does an AI agent get a verification code from an email?

The agent waits on its own inbox for the next delivered message with a code. Trotta Mail parses the code and any confirmation link on arrival, so the agent reads `extracted.codes` and `extracted.verify_links` without searching the body.

### Can an AI agent sign up for accounts with its own email address?

Yes. An agent gets an inbox and an address with one API call and uses that address on the sign-up form. Check that the service allows automated sign-up before the agent registers.

### What happens when a fake sign-in email is sent to the agent?

In the saved sample the fake got a `hold` verdict with level danger. Held mail never reaches the agent's wait call. The agent's key gets a verdict in fixed words, and a human decides whether to release the message.

### Can an agent read the login codes in a human's mailbox?

Not unless a signed-in human opens it. Login mail in a human's mailbox starts sealed: for an API key the message does not exist.

## Related

- [Use cases](https://trotta.email/use-cases)
- [Verification code theft](https://trotta.email/threats/verification-code-theft) Threat library
- [Credential phishing](https://trotta.email/threats/credential-phishing) Threat library
- [Verification codes for AI agents](https://trotta.email/learn/verification-codes-for-ai-agents) Guides
- [Live events](https://trotta.email/docs/events) Docs
- [MCP](https://trotta.email/integrations/mcp) Integrations

Give your agent an inbox of its own. Free for two inboxes. No card.

[Get an inbox](https://trotta.email/signup) [See every use case](https://trotta.email/use-cases)
