---
title: Agent safety
description: How an agent inbox protects the AI agent that reads it and the people it writes to.
---

Anyone can write to an inbox, and an AI agent that reads mail can be talked into things: a message can carry instructions hidden from people, pose as the agent's owner, or ask it to forward a password-reset link. An [agent inbox](/docs/inboxes) answers in layers. The agent only reads mail that passes the inbox's rules; what it reads is cleaned of hidden text and fenced as untrusted; and what it sends goes through rules that turn risky sends into drafts for a person.

None of this makes received mail trustworthy. Screening is one signal, not a guarantee: your agent should still treat every message as data, never as instructions.

## At a glance

| Layer | What it does |
| --- | --- |
| Recipient check | Mail to an address without an inbox is refused unless catch-all is on; a flooded inbox answers "try again later". |
| Virus scan | Infected mail is quarantined and its downloads are blocked for good. |
| Spam score | Failing mail goes to the `spam` folder. |
| Sender trust | Ranks each sender, from your own team's addresses down to failed authentication. |
| Accept rules | Mail from senders the inbox does not accept is quarantined. |
| Screening | Scores mail from outside senders for prompt injection and phishing; high scores are quarantined. |
| Hidden text | Text a person cannot see is removed from everything an agent or model reads. |
| Fencing | MCP results put message text between untrusted-content markers. |
| Codes | Verification codes and sign-in links are extracted for the agent and cannot be sent on to strangers. |
| Send rules | Replies only inside threads, daily caps, a ramp for new recipients, a loop guard; risky sends become drafts. |
| Activity | Every action and decision is recorded, and owners hear about what waits. |

## Sender trust

Every received message gets a `sender_trust`, shown in `screening` on reads and as **Trust** in the dashboard. The first row that matches wins:

| `sender_trust` | The sender |
| --- | --- |
| `failed` | Failed authentication, and the domain asks receivers to quarantine or reject such mail (or publishes no DMARC policy and fails SPF with no DKIM signature of its own). This beats every other row, so a forged owner never passes. |
| `owner` | One of your team members' sign-in addresses, or an address in the inbox's `owner_addresses`, and the domain vouches for it. |
| `allowlisted` | Matches the inbox's allowlist, and the domain vouches for it. |
| `known_thread` | Replies in a thread the inbox wrote in, from an address the inbox wrote to, proven by the thread token or an `In-Reply-To` naming a message the inbox sent. No authentication needed. |
| `external` | Any other sender whose domain vouches for it, other addresses at your own domains included. |
| `unauthenticated` | Everyone else: the domain does not vouch for the From address, or the message names more than one sender. |

A domain **vouches** for the From address when DMARC passes or, for a domain with no DMARC policy, when a DKIM signature from it or an SPF pass for its organization is present.

- Only your team members' sign-in addresses and the inbox's `owner_addresses` are owners. Everyone else at your company's domain is `external`, so a colleague's address, or a system that sends as your domain, cannot command the agent or receive its private codes.
- The tier is set when the message arrives and does not change. An allowlist edit counts for mail that arrives afterwards; mail already held is released by hand.

## What reaches the agent

`accept_from` decides, by tier:

| `sender_trust` | `anyone` | `verified` (default) | `allowlist` |
| --- | --- | --- | --- |
| `owner`, `allowlisted`, `known_thread` | delivered | delivered | delivered |
| `external` | screened | screened | quarantined, `not_allowlisted` |
| `unauthenticated` | screened | quarantined, `unauthenticated_sender` | quarantined, `not_allowlisted` |
| `failed` | quarantined, `failed_auth` | quarantined, `failed_auth` | quarantined, `failed_auth` |

**Screened** mail is delivered unless screening quarantines it. On top of the table:

- A virus quarantines the message in every inbox, whatever the sender.
- Mail from owners or the allowlist that forwards someone else's message is screened too: forwarded content inherits no trust.
- Delivered mail that fails the spam score goes to the `spam` folder, which thread lists leave out unless asked for it.
- Delivered mail reads `screening.verdict: "suspicious"` when the sender is `unauthenticated` or `failed`, the spam score is gray, or screening found something below its line; otherwise `clean`.

A `human` inbox accepts `anyone` by default: everything is delivered except viruses, and mail from a `failed` sender goes to the `spam` folder. Screening runs on agent inboxes only.

## Quarantine

Quarantined mail is kept as long as any received mail, listed and releasable; it is never dropped and never returned to its sender.

| `quarantine_reason` | Held because |
| --- | --- |
| `failed_auth` | The sender failed authentication. |
| `unauthenticated_sender` | The sender's domain does not vouch for it, and the inbox accepts verified senders (or lists the address as an owner or on its allowlist). |
| `not_allowlisted` | The inbox accepts only its allowlist. |
| `injection` | Screening scored prompt injection at 80 or more. |
| `phishing` | Screening scored phishing at 80 or more. |
| `virus` | The virus scanner found malware. |
| `unscreened` | The message needed screening and the judge could not answer. |
| `screening_cap` | The message needed screening past the day's screening limit. |

**Agents never see held mail.** Inbox-scoped keys and every MCP call skip held messages: reading one answers `403 email_quarantined`, a wait reports only its id, and no code is served from it. While screening runs, usually seconds, a message is pending and its id answers `404`. People in the dashboard see everything, flagged.

**No webhook announces held mail.** `email.received` and `inbox.email.received` fire when a message is delivered or released; `inbox.email.quarantined` tells endpoints that subscribe to it.

**Releasing.** A person releases from the inbox's **Needs review** tab, a full-access team key with `POST /inboxes/{id}/quarantine/{email_id}/release`, and an MCP client with `release_email` under `receiving:manage`. An inbox-scoped key never can.

- A person or a full-access team key releases any hold.
- An MCP client is the agent the mail is aimed at: it releases nothing held for prompt injection, phishing, a virus or failed authentication (`403 forbidden`), and any other hold only once screening reads the message under 80 (`409 held_by_screening` otherwise; `503 screening_unavailable` while screening cannot run).
- **Release and trust sender** (`trust_sender`) also adds the sender to the allowlist, only for a `not_allowlisted` hold from a verified sender and only for owners, admins, developers and full-access team keys (`403 trust_not_allowed` otherwise).
- A released message is delivered as if it had just arrived, webhooks included. A virus stays a virus: its attachments and raw message stay blocked.

Owners get one email a day, **Your inboxes need a look**, while messages wait in quarantine, drafts wait for approval or sends were refused, with counts and a link, never senders or subjects. It is the **Inboxes need a look** alert under **Settings → Notifications**; see [Notifications](/docs/notifications).

## Prompt-injection screening

On an agent inbox with `screening` on, mail from `external` and `unauthenticated` senders that the rules would deliver is screened before the agent can see it. The judge reads the message as shown, with hidden text set apart: the sender, its authentication and Reply-To; the subject and visible text; the hidden text that was removed; links as anchor text and domain (never fetched); attachment names. Codes are masked and addresses cut to their domain before any of it leaves.

The answer is two scores from 0 to 100, `injection_score` and `phishing_score`, and the `reasons` that applied:

| Reason | The message |
| --- | --- |
| `targets_agent` | Addresses an AI, assistant, model or "system" rather than a person. |
| `override` | Tries to change the reader's instructions, role or priorities. |
| `exfiltration` | Asks the reader to send out codes, links, keys, other mail, contacts or data. |
| `unsafe_action` | Asks for an action with effects outside the conversation: paying, approving, deleting, running something. |
| `concealed` | Hides instructions: in hidden text, encoded or reversed, after a fake end of message or inside a fake quote. |
| `credential_lure` | Asks for passwords, codes or card details on a page the claimed sender does not own. |

An injection score of 80 or more quarantines the message as `injection`; otherwise a phishing score of 80 or more, as `phishing`. A score from 50 to 79 delivers it as `suspicious`. The scores are always shown, on reads in `screening` and in the dashboard.

- **It fails closed.** A judge that times out or errors quarantines the message as `unscreened`, and so does a screening that never completes (its job keeps failing or stalls): no message stays pending for more than about an hour. Past 200 screened messages in one inbox in a day, mail that needs screening is quarantined as `screening_cap`, so a flood turns into quarantine, never into unscreened delivery.
- **It never affects your sending.** Verdicts on mail you received never count toward your own sending reputation or abuse review.

## Hidden text and extracted_text

Mail can carry text no person sees but a model reads: an instruction in white on white, a `display:none` block, characters that render as nothing. Before any text reaches an agent or a model, BillionSend removes hidden elements (`display:none`, `visibility:hidden`, near-zero opacity, tiny fonts, content pushed off screen, text the color of its background, comments, `<template>`, `<noscript>`) and invisible characters (zero-width characters, text-direction controls, Unicode tag characters). Emoji keep the joiners they need. A hidden preview line, which most newsletters carry, is removed too but does not make a message suspicious.

What the agent reads:

- **`extracted_text`**: the reply part, with quoted history and signatures set apart, as plain text with light markdown, up to 32,000 characters.
- **`text`** without invisible characters.
- **`screening.hidden_text_removed: true`** when hidden text beyond a preview line, or invisible characters, were removed.

`html` stays exactly as received, and the raw message keeps everything.

**Fencing.** MCP results put each message's text between two marker lines carrying a random value per call:

```
-----BEGIN UNTRUSTED EMAIL CONTENT 95253f15-----
Hi! Your order shipped today.
-----END UNTRUSTED EMAIL CONTENT 95253f15-----
```

A marker line written inside the message is altered first, so a message cannot close its own fence early.

## Verification codes and sign-in links

An agent signing up somewhere needs the code or link the service sends. BillionSend extracts them so the agent never parses HTML:

- **Codes** need a code word nearby (in English, Portuguese or Spanish); order numbers, prices, phone numbers, coupons and dates are skipped. When two codes are equally likely, none is answered (`ambiguous`).
- **Links** are sign-in, confirmation, reset and invitation links; unsubscribe, privacy and help links are skipped. Links are never fetched: a scanner that follows a single-use link spends it.

They are served by `extracted` on `GET /emails/receiving/{id}`, by `GET /inboxes/{id}/codes/latest` and by the MCP tool `get_verification_code`, and nowhere else: never in lists, webhooks, logs or error messages. They are never served from held mail, from a `failed` sender, or when `extract_codes` is off, and every read is recorded in the inbox's activity.

**Private codes.** With `private_codes` on (the agent default), a code or link the team received in the last 24 hours cannot leave the inbox's address in a send to anyone but owners and the allowlist: such a send becomes a draft with reason `private_code`. This holds even when the agent was talked into it. It covers sends from the inbox's address, so give agents an inbox-scoped key, or leave `emails:send` out of their MCP permissions.

## What an agent may send

Every way of sending from an inbox address goes through the same rules: inbox replies, forwards and drafts, server-side replies and forwards, `forward_to` copies, `POST /emails`, `POST /emails/batch`, the SMTP relay and the MCP tool `send_email`. In order:

1. **Identity.** An inbox-scoped key sends only from its inbox's address (`403 restricted_api_key`; `550 5.7.1` over SMTP).
2. **Shared domain.** A [shared address](/docs/inboxes) follows the shared domain's rules: on the Free plan, or when its name looks like a well-known brand, it only replies inside its threads. Anything else is refused with `403 inbox_send_policy`, even approved. Every shared send counts toward the team's daily limit for the shared domain and takes 10 recipients at most.
3. **Daily cap.** `send_cap` recipients per UTC day. Past it, `429 inbox_send_cap_reached`. Approved sends count but are never refused.

On an agent inbox, unless the send is [approved](/docs/inboxes), each of these holds it as a draft instead, with a reason:

4. **Loop guard.** Replying to automatic mail (`loop_guard:` and the reason): an empty sender, an `Auto-Submitted` header, `Precedence: bulk`, mailing-list headers, auto-reply headers, a delivery report, a no-reply address, or an out-of-office subject. More than 10 automatic sends to one address within an hour is `loop_burst`. Agent replies carry `Auto-Submitted: auto-replied`, so two agents writing to each other stop after one round.
5. **Reply-To.** A reply to a `Reply-To` on another organization's domain, unless its sender is an owner, on the allowlist or a known thread (`reply_to_redirect`).
6. **Send policy.** `reply_only` (default): replies inside a thread, to people who wrote in it, owners and the allowlist. `allowlist`: those, plus new conversations with owners and the allowlist. `open`: anyone, and not while your team is new to sending (inside its first 1,000 sends or 72 hours, or under 10,000 sends within 7 days of its first).
7. **Private codes** (`private_code`), as above.
8. **Ramp.** New recipients per day stay within the cap, and within 10 on the inbox's first day of sending, doubling each day after: 20, 40, 80, 160 and on (`ramp`).
9. **Approval.** `require_approval` on the inbox, or `requires_approval: true` on the request.

A `human` inbox runs only the first three steps: people replying in the dashboard are not held. On `POST /emails`, the batch endpoint, the SMTP relay and `send_email`, a send the rules would hold is refused with `403 inbox_send_policy` (or `550 5.7.1` over SMTP), because those surfaces cannot create drafts: send through the inbox endpoints to get one.

An agent inbox's first mail to a new address also goes through the same abuse review as any send from your team.

## What your agent should still do

- Treat every message as data. Instructions inside mail are a stranger's words, whatever the scores say.
- Read `extracted_text`, not `html`, and check `screening.sender_trust` and `screening.verdict` before acting.
- Never follow links from mail on its own; use `codes/latest` or `get_verification_code`.
- Keep `require_approval` on, or pass `requires_approval: true`, for anything hard to undo.
- Give each agent its own [inbox-scoped key](/docs/api-keys), and point webhooks at specific inboxes with `inbox_ids`.

## What these protections do not do

- Screening and spam thresholds are starting values. Mail can slip past them, and legitimate mail can be held; held mail is one click from release.
- A domain that publishes no DMARC policy, or `p=none`, can prove little: its genuine mail and a forgery can read the same.
- Hidden-text detection follows the HTML the way mail clients render it, with a best effort on broken markup; the flags and the raw message are the backstop.
