> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notte.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# AgentMail

> Give Notte personas an AgentMail inbox for sign-ups and verification emails

> [!TIP]
>
> Read [the Notte skill](https://notte.cc/skill.md) and follow its setup instructions when setting up Notte or building browser automation. This is the shared source for CLI setup, authentication, and the browser-to-code workflow.

[AgentMail](https://agentmail.to) is an email inbox API built for AI agents. Notte [personas](https://docs.notte.cc/concepts/personas.md) can use an AgentMail inbox instead of the default Notte mailbox: set `email_provider="agentmail"` when you create the persona and it gets its own `@agentmail.to` address.

Use the persona's email address in a sign-up form, then read the inbox to retrieve the site's verification code or link.

Notte creates and manages the AgentMail inbox for you. You don't need an AgentMail account or API key.

## Prerequisites

* A Notte API key ([get one here](https://console.notte.cc/apikeys))
* The Notte Python SDK (`pip install notte-sdk`), in a version that supports the `email_provider` option

## Create a persona with an AgentMail inbox

Pass `email_provider="agentmail"` when you create the persona. The default is `"notte"`.

```python agentmail_persona.py theme={null}
from notte_sdk import NotteClient

client = NotteClient()

# email_provider defaults to "notte"; "agentmail" gives the persona an AgentMail inbox
persona = client.Persona(email_provider="agentmail")
print(f"Persona email: {persona.info.email}")  # an @agentmail.to address

# read emails exactly as with the default provider
emails = persona.emails(limit=10)
for email in emails:
    print(email.subject)

# deleting the persona also deletes its AgentMail inbox
persona.delete()
```

With the REST API, send `email_provider` to `POST /personas/create`:

```bash cURL theme={null}
# create a persona with an AgentMail inbox
curl -X POST https://api.notte.cc/personas/create \
  -H "Authorization: Bearer $NOTTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email_provider": "agentmail"}'

# read the persona's emails
curl "https://api.notte.cc/personas/YOUR_PERSONA_ID/emails?limit=10" \
  -H "Authorization: Bearer $NOTTE_API_KEY"
```

The persona response includes `email_provider`, so you can check which inbox a persona uses.

## Read emails from the inbox

You can also read the inbox yourself, for example to extract a verification code or link in your own code:

```python agentmail_read_emails.py theme={null}
import datetime as dt
import re

from notte_sdk import NotteClient

client = NotteClient()
persona = client.Persona("<your-persona-id>")

# unread emails received in the last 10 minutes
emails = persona.emails(only_unread=True, limit=10, timedelta=dt.timedelta(minutes=10))

for email in emails:
    print(f"{email.created_at} {email.sender_email}: {email.subject}")
    # pull a 6-digit verification code out of the body, if there is one
    match = re.search(r"\b\d{6}\b", email.text_content or "")
    if match:
        print(f"Verification code: {match.group()}")
    # verification links found in the body
    print(email.links())
```

Each email includes the subject, sender, timestamp, and text and HTML bodies. `email.links()` returns the URLs found in the text body.

## Limitations

* AgentMail inboxes are receive-only. Personas cannot send email.
* Deleting the persona also deletes its AgentMail inbox.

## Next steps

> [card] [Persona Identities](https://docs.notte.cc/concepts/personas.md)
>
> Everything a persona can do.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.