Email Channel¶
Overview¶
The Email channel receives messages via IMAP polling and sends replies via SMTP. No public endpoint is required. It is suited for asynchronous communication scenarios such as support tickets and automated email replies.
Since email is inherently asynchronous, this channel is marked is_realtime=False — the agent delivers only the final generated message in one shot, with no streaming output.
Configuration Example¶
channels:
email:
enabled: true
imap_host: imap.gmail.com
imap_port: 993
smtp_host: smtp.gmail.com
smtp_port: 465
username: bot@example.com
password: ${EMAIL_APP_PASSWORD}
use_ssl: true
poll_interval_seconds: 30
allow_from:
- admin@example.com
- support@example.com
| Field | Type | Default | Description |
|---|---|---|---|
imap_host |
string | — | IMAP server address |
imap_port |
int | 993 | IMAP port (SSL) |
smtp_host |
string | — | SMTP server address |
smtp_port |
int | 465 | SMTP port (SSL) |
username |
string | — | Login account |
password |
string | — | Password or app-specific password |
use_ssl |
bool | true | Enable SSL/TLS |
poll_interval_seconds |
int | 30 | IMAP polling interval in seconds |
allow_from |
list | [] | Sender allowlist; empty accepts all senders |
Credentials¶
Gmail¶
- Go to Google Account Security Settings
- Enable 2-Step Verification (if not already enabled)
- Generate a 16-character App Password under "App passwords"
- Use this password in the
passwordconfig field
Do not use your regular Gmail password
Google has disabled "Less secure app access" for direct IMAP/SMTP login with account passwords. You must use an App Password or the connection will be rejected.
Outlook / Microsoft 365¶
- Use
outlook.office365.com(IMAP) andsmtp.office365.com(SMTP, port 587) - If your organization enforces OAuth2, an admin must authorize IMAP access
QQ Mail¶
- Log in to QQ Mail → Settings → Account → POP3/IMAP/SMTP service
- Enable IMAP/SMTP service and obtain the authorization code
- Use the authorization code (not your QQ password) as
password
QQ Mail configuration reference
- IMAP:
imap.qq.com:993 - SMTP:
smtp.qq.com:465 - The password field should contain the authorization code
Capability Matrix¶
| Capability | Supported | Notes |
|---|---|---|
| Edit sent messages | No | Email protocol does not support recall/edit |
| Reactions | No | — |
| File attachments | No | Current version does not process attachments |
| Realtime streaming | No | Async delivery, final result only |
| Group / multi-party | No | Separate sessions per sender |
Internal Mechanics¶
UID Watermark Persistence¶
The channel uses IMAP UIDs as watermarks to track processed emails. The watermark is atomically written to disk, ensuring:
- No duplicate processing of already-read emails after process restart
- No progress loss on abnormal exit (atomic write guarantees consistency)
Email Processing Flow¶
- IMAP poll fetches emails with UID > current watermark
- HTML body is automatically converted to plain text (preserving readable structure)
- Reply threading is tracked via Subject line (
Re:prefix matching) - After the agent generates a reply, it is sent via SMTP with the
In-Reply-Toheader set automatically
FAQ¶
What polling interval should I use?
30-60 seconds is recommended. Too short (<10s) may trigger rate limiting from email providers; too long increases user wait time. Gmail IMAP IDLE is not currently supported.
What happens when allow_from is empty?
The channel will accept emails from all senders. In production, configuring an allowlist is recommended to prevent abuse.
How are HTML emails handled?
Inbound HTML email bodies are automatically converted to plain text before being passed to the agent. Outbound replies are sent as plain text.
Attachments are not processed
Body extraction takes the first text/plain part, falling back to text/html converted to plain text. Every other MIME part — attachments included — is skipped: the agent neither sees attachment content nor learns that the mail had any.
Workflows that depend on attachments are therefore not served by this channel. To have documents processed, place them in the knowledge directory or the workspace and reference the path in the message body.