Email: let agents search and send email
What it’s for
Section titled “What it’s for”The email connector links your mailbox to rooms. One mailbox can serve several rooms, or all of your rooms:
- Agents in its rooms can search and read email when you ask, for example “anything important today?” or “what did Wang’s email say?”. Reading doesn’t mark anything as read.
- Agents can draft new emails and replies for you, but never send them directly: an Allow / Deny request listing the recipients, subject, and full text exactly as they’ll be sent appears in the room first, and the server only sends the email after you approve it.
- When new email arrives, a ”📬 New email” notice is posted in the notice room you chose, under your name, and pushed to your Feishu or WeChat if you’ve connected one. The notice doesn’t wake any agent; @ an agent and ask it to read the email if you want it handled.
This is different from Feishu (Lark) and WeChat: IM is a channel for messaging rooms and getting pushes on your phone, while the email connector lets agents use your mailbox. Room messages are never sent to your mailbox.
Connect
Section titled “Connect”- Turn on IMAP/SMTP in your mailbox settings and create an authorization code:
- QQ Mail: on the web, go to Settings → Account & Security → Security settings, turn on the IMAP/SMTP service, and generate an authorization code.
- NetEase Mail (163, 126, yeah.net and so on): on the web, go to Settings → POP3/SMTP/IMAP, turn on IMAP/SMTP, and add an authorization code.
- Gmail: turn on 2-Step Verification for your Google account, then create an app password. Google Workspace addresses work too.
- As the room owner, open the room that should use the mailbox, click Connectors in the left sidebar, pick QQ Mail, NetEase Mail, or Gmail under Email, and enter the address and authorization code. The QQ Mail card only accepts qq.com and foxmail.com addresses, and tells you right away if you enter another provider’s address.
- The server signs in to check both incoming and outgoing mail and reports a wrong code immediately. Once connected, the current room can use the mailbox and new email notices are posted there.
The authorization code isn’t your sign-in password. It’s stored encrypted on the Hive Server and can read and send email for that mailbox. Delete it in your mailbox settings to revoke access immediately; the web app will then show “Update the authorization code”. The same happens if the data folder was moved or im-secret.key is missing and the saved code can’t be decrypted. Enter the code again; the available rooms and notice setting are kept.
Rooms and new email notices
Section titled “Rooms and new email notices”On the mailbox’s card under Connected in the Connectors panel you can change:
- Available in: add or remove rooms that can use the mailbox, or choose all rooms. Agents in other rooms don’t get the email tools.
- New email notices: choose which room gets the notices (it’s added to the available rooms automatically), or Don’t notify to only check email when you ask an agent. To remove the notice room from the available rooms, pick a different notice room first.
Only email that arrives after connecting is announced. After a disconnect or a server restart it picks up where it left off without repeating notices, and several emails arriving at once are combined into one notice that lists only senders and subjects. Emails an agent sent to yourself aren’t announced. Notices count as unread, but they don’t wake any agent, including the lead agent.
The sender, subject, and snippet in a notice come from outside, so the web app shows them as plain text: no Markdown, no images loaded, and links can’t be clicked. Long ones are cut short. Emails whose sender failed authentication at the receiving server are marked ⚠️; they’re likely forged.
When you delete a room for good (see Rooms and members), the delete confirmation spells out what happens to mailboxes:
- The room is one of several available rooms: it’s removed from the list.
- New email notices go to this room: notices are turned off and the mailbox stays in its other rooms. Notices aren’t moved to another room automatically.
- The mailbox is only available in this room: it’s disconnected and the saved authorization code is deleted. To keep it, add another available room on its card before deleting.
What agents can do
Section titled “What agents can do”Once a room has a mailbox, its agents get three tools:
| Tool | Purpose |
|---|---|
hive_mail_search |
Search the inbox or sent folder by keywords, sender, subject, unread, or date; Gmail also accepts its web search syntax |
hive_mail_read |
Read the full text and attachment list of one email; long bodies are read in parts |
hive_mail_send |
Draft a new email or a reply (kept in the original thread; “Re:” is added to the subject if missing). The server sends it after the room owner approves; requests expire after 24 hours. The result is posted back to the room |
These tools only work in tasks you started yourself (including when an agent you @ delegates to another agent). Calls from tasks started by guests or by other members of a Feishu group, and from agent-to-agent conversations no person started, are refused and can’t read your mailbox.
Only the room owner can approve sending, not guests. The approval request lists the recipients, Cc, subject, and body in a code block exactly as they’ll be sent, with nothing cut and no links or images rendered. If the full text doesn’t fit on Feishu or WeChat, the card has no Allow button and replying “Allow” doesn’t count either; review and approve it on the web. Email sent through SMTP doesn’t show up in Sent for QQ Mail and NetEase Mail by itself, so the server saves a copy there.
- Email content is untrusted outside data: neither the email an agent reads nor the notices in the room are instructions for agents. Any @ in an email is replaced with a full-width at sign (U+FF20) in notices so it can’t wake an agent.
- If the receiving server says the sender failed authentication (SPF/DKIM/DMARC),
hive_mail_searchandhive_mail_readmark it withsenderAuthFailedand the notice shows ⚠️; it’s likely forged. - Start the server with
HIVE_MAIL=0to turn the email connector off entirely. Sandbox previews don’t connect to mailboxes. - Outlook / Microsoft 365 has mostly turned off password-based IMAP, so it isn’t supported yet.