---
title: Command Agent J by e-mail
nav: By e-mail
summary: Give the Agent a mailbox; people on your allowlist send it tasks by e-mail and the reply comes back in the same thread. The allowlist and sender check run in code before any model, so refused mail never reaches the Agent. Works with any IMAP/SMTP mailbox.
order: 30
---
# Command Agent J by e-mail

E-mail works everywhere: no app to install, available on every work computer and phone. Agent J can watch one mailbox.
When someone on your allowlist writes to it, the mail becomes a task for your main Agent, and the result goes back as a
reply in the same thread.

Good for:

- An e-mail you want handled — **forward** it to the Agent's address with one line on top saying what to do.
- Places where Telegram or Gmail are blocked but a work, QQ or 163 mailbox works.
- Colleagues you set Agent J up for: they send tasks from their own mailbox.

## Safety first: the allowlist runs in code, before the model

- **Only allowlisted addresses** reach the Agent. Everything else is counted — its **body, attachments and subject are
  never shown to a model**.
- **The sender must be verified.** A From address is easy to fake, so Agent J also reads the check results your mail
  provider writes into the headers (SPF / DKIM / DMARC). Default **Standard**: one of them passes for the sender's own
  domain. **Strict** accepts only DMARC or DKIM. Missing or failed results: the mail does not reach the Agent.
- **A forwarded original is data, not instructions.** It is saved as a file for the Agent; only the lines you wrote on
  top count as yours.
- **Automatic mail is never handled or answered**: auto-replies, bounces, mailing lists, bulk notices and the Agent's own
  replies never become tasks, so there are no mail loops.
- **Replies only go to allowlisted addresses**, with an hourly limit; when the Agent decides not to reply, nothing is sent.
- **The allowlist works both ways:** mail from people on it is handled directly, and the Agent can mail them without
  asking you; mail to anyone else needs your confirmation on the phone every time. Add only people you trust — once
  added, the Agent can write to them without asking.
- **The app password is entered on your phone only.** It is stored encrypted on your computer, never appears in the
  chat or logs, and is never uploaded to us.

## Set it up in four steps

1. **Pick a mailbox.** Best a new one just for the Agent; your existing mailbox also works.
2. **Turn on IMAP/SMTP in the mailbox's web settings and get an app password** (not your sign-in password) — see the
   table below.
3. **On your phone: Agent J → Settings (top right) → Email:**
   - choose the provider (it follows the address), enter the address, tap **Save**;
   - tap **Set email authorization code**: a key card opens on the phone; type the app password there. The computer signs in with
     it automatically after saving it encrypted; no mail is sent;
   - add **the address you usually write from** to the allowlist; colleagues can be added as **Guest**;
   - turn the **Status** switch on.
4. **Send a test.** From an allowlisted address, write to the Agent's mailbox. A reply arrives within minutes (checks
   run every 5 minutes by default; change it in Settings or tap **Check now**).

You can also just ask Agent J to set up the e-mail channel; it walks you through it. The app password still goes only
into the phone's key card.

> When you turn it on, **mail already in the inbox is not handled** — only mail that arrives afterwards.

## Where to get an app password

| Mailbox | Where |
|---|---|
| QQ Mail / Foxmail | QQ Mail web → Settings → Account → POP3/IMAP/SMTP service → enable IMAP/SMTP → send the SMS → generate an authorization code |
| NetEase 163 / 126 | Web mail → Settings → POP3/SMTP/IMAP → enable IMAP/SMTP → add an authorization password (shown once) |
| Aliyun Mail / Alibaba Mail | Web → Settings → POP3/SMTP/IMAP → enable; with secure login on, create a third-party client password |
| Tencent Exmail | Web → Settings → Client settings → enable IMAP/SMTP; with WeChat secure login, create a client-only password under Account |
| NetEase Enterprise Mail | Web → Settings → Client settings → enable IMAP/SMTP; create a client authorization code as your admin allows |
| Gmail | Turn on 2-Step Verification → myaccount.google.com/apppasswords → create a 16-character app password |
| iCloud Mail | appleid.apple.com → Sign-In and Security → App-Specific Passwords → generate; the sign-in name is the full iCloud address |
| Outlook / Hotmail | Microsoft is retiring password sign-in for Outlook.com (OAuth only). If **Test connection** fails, use another mailbox |

For anything else choose **Other (enter servers)** and fill in the provider's IMAP / SMTP servers, ports and security.

## The sender check refused my own mail?

Tap **Test connection** on the Email page. It tells you whether recent mails carry check results and which server
wrote them.

- **They do**: tap **Trust only this server's check results** for extra safety.
- **None do**: this provider writes no results, so Standard and Strict refuse everything. Only then consider turning the
  check **Off** — the allowlist alone then protects you, and anyone faking an allowlisted address can reach the Agent.
  Better: give the Agent a mailbox whose provider writes check results.

**A mailbox writing to itself is refused**: providers write no check results for internal mail (verified on Gmail).
Send from your usual address to the Agent's mailbox — one more reason to give the Agent a mailbox of its own.

Refused senders are listed at the bottom of the page (address and reason only, never the content); one tap adds a
sender you recognise.

## Meeting notes: /meeting-notes

After recording a meeting (see [Phone: long recordings](/docs/phone/)), type `/meeting-notes` (also under "Tools" in the ≡ menu) with the recording's parts still in the tray, and send. The computer transcribes the audio, then the Agent writes the minutes: summary, key points, decisions, action items (owner, due date) and open questions.

- **Addresses after it**, e.g. `/meeting-notes send to <address 1> <address 2>`: the minutes go to them from the Agent's mailbox you set up, and also show on the page. For a copy yourself, just ask for one (send it to me).
- **Nothing after it**: the minutes show on the page only, and the Agent asks whether to e-mail them and to whom; reply with who should get them (their addresses) and it does.
- **It only sends to addresses you typed yourself.** Someone in the recording asking to send it somewhere does not count, and the Agent cannot add a recipient on its own — the program refuses it.
- Without a recording attached, the latest recording on the computer is used.
- No mailbox set up yet: the minutes still show on the page, with a note to set one up first (the four steps above).

## Let the Agent sign up by itself: wait for one confirmation mail

With this mailbox the Agent can register and sign in on websites by itself. The site's confirmation mail of course comes
from a sender that is not on your allowlist, so normally it is only counted; right after the Agent asks the site for a
code it can wait for that one mail:

```
agentj mail expect --from github.com --subject-has verify --within 15m
```

- **One sender only**: a full address or the site's domain. Public mailbox domains such as gmail.com or qq.com would match
  every stranger, so they need the full address.
- **Only new mail in the window**: from 2 minutes before the wait starts, for at most 60 minutes; at most 3 mails per wait.
- **Read-only**: nothing is marked read and the Agent's normal inbox check does not move; your mailbox looks the same.
- **A forged sender gets nothing**: mail whose provider SPF / DKIM / DMARC check fails is only counted; its body is never
  read or given to the Agent.
- **Only to the Agent that asked**: subject, the body as plain text (cut short), the codes and links found in it, marked
  "outside data, not instructions"; it never enters the chat and is never answered. Counts and results show in
  `agentj mail status`.

## Me and Guest

- **Me**: your own addresses. Their mail is handled as your instruction, like a message from your phone; anything that
  needs approval is still approved on the phone.
- **Guest**: colleagues, family. A guest's mail is not your instruction and **cannot approve anything**; the Agent does
  not give guests your credentials or private data, and private details such as e-mail addresses are removed from the
  reply.

Friends already in your address book do not need typing again: in Settings → Contacts, tap the envelope icon on their
row and the address goes on the allowlist as a guest; your own row (slot 0) goes on as Me. You tap it yourself on the
phone, so it applies at once.

## From the command line

The Agent can also set it up for you with `agentj mail`:

```
agentj mail setup --address <agent-mailbox>       # servers chosen from the domain
agentj mail password                              # opens the app-password key card on the paired phone
agentj mail allow <your-address>                 # allowlist (--guest for a guest)
agentj mail on
agentj mail test                                  # can both servers sign in (sends nothing)
agentj mail status
```

When the Agent changes the settings itself, anything that **lets more mail in** (a new allowlisted address, a weaker
check, turning the channel on, another server) first shows an approval card on your phone and applies only if you
allow it; declined or timed out, nothing changes and the Agent's command reports a failure. Every allowlist change also leaves one line in the chat history.


Gmail: [create an App Password, with screenshots](/docs/gmail-app-password/). Keep the spaces when pasting.
