Skip to content
EN

Email: let agents search and send email

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.

  1. 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.
  2. As the room owner, open the room that should use the mailbox, click Connectors (the plug icon in the last row of the sidebar’s quick actions), 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.
  3. 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.

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.

Read the full email, mark as read, and star

Section titled “Read the full email, mark as read, and star”

Only the room owner gets these on the web. Guests and exported share cards still show just the snippet. They’re also hidden while the mailbox is disconnected; reconnect it under Connectors to get them back.

  • Read full mail: on a single-email card, click Read full mail; on a multi-email card, click a row to open that email. The dialog shows the sender, recipients, Cc, time, body, and attachments, which download when clicked. Long emails scroll inside the dialog instead of stretching the room’s message list. Press Esc, click the close button, or click outside the dialog to close it.
  • HTML email is shown in an isolated frame: scripts in the email don’t run, forms can’t be submitted, and every link opens in a new tab. To prevent tracking, remote images aren’t loaded until you click Show images; images embedded in the email show as usual. In the dark theme the email keeps its white background (the sender designed its colors for one) and is dimmed slightly.
  • Plain-text email keeps its line breaks and its links are clickable. Text quoted from earlier emails in a reply is collapsed; click Show quoted text to expand it.
  • If the sender failed authentication, the top of the dialog says so and links in the email are disabled.
  • Read and starred: both the card and the dialog can mark an email as read or unread and star or unstar it. This changes the flags on the mail server (IMAP \Seen and \Flagged), so your phone and other mail apps see the same thing. Unread emails say Unread on the card (on a multi-email card, the row starts with a solid dot and the subject is bold), starred ones have a filled star, and emails that were deleted or moved out of the inbox say No longer in inbox.
  • Opening the full email marks it as read, like most mail apps; click Mark as unread to keep it for later. Agents reading email with hive_mail_read don’t change whether it’s read.
  • The mail server is the source of truth: flags are checked when a card appears and when you open the full email, so changes made elsewhere show up here.
  • The snippet on the card keeps only what the sender newly wrote: quoted text from earlier emails (Gmail’s “On … wrote:”, the “Original Message” header QQ Mail and Outlook add, and the like) is dropped, and leftover HTML entities such as ' are turned back into characters.

Single-email notices pushed to Feishu have a Read in browser button that opens the web app with your login and shows that email right away; notices that combine several emails open the room. Marking as read and starring are web-only.

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. The inbox is opened read-only, so the email isn’t marked as read
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, and tasks an agent forwards to this room from another room for you with hive_room_post). 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_search and hive_mail_read mark it with senderAuthFailed and the notice shows ⚠️; it’s likely forged.
  • Start the server with HIVE_MAIL=0 to 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.