website/docs/user-guide/messaging/email.md
Hermes can receive and reply to emails using standard IMAP and SMTP protocols. Send an email to the agent's address and it replies in-thread — no special client or bot API needed. Works with Gmail, Outlook, Yahoo, Fastmail, or any provider that supports IMAP/SMTP.
:::info Gateway adapter only: no external dependencies
This page covers the Email gateway adapter, which uses Python's built-in imaplib, smtplib, and email modules. No additional packages or external services are required for this gateway path.
:::
This is separate from the bundled Himalaya email skill, which lets the agent manage email through terminal commands and requires the external himalaya CLI plus a Himalaya config file.
| Use case | What to configure | External dependency |
|---|---|---|
| Let people email the Hermes agent and receive replies | Email gateway adapter on this page | None beyond an IMAP/SMTP email account |
| Let the agent inspect, compose, move, and manage mailbox messages from terminal tools | Himalaya email skill | himalaya CLI and ~/.config/himalaya/config.toml |
outlook.office365.com, SMTP host: smtp.office365.comMost email providers support IMAP/SMTP. Check your provider's documentation for:
The easiest way:
hermes gateway setup
Select Email from the platform menu. The wizard prompts for your email address, password, IMAP/SMTP hosts, and allowed senders.
Add to ~/.hermes/.env:
# Required
[email protected]
EMAIL_PASSWORD=abcd efgh ijkl mnop # App password (not your regular password)
EMAIL_IMAP_HOST=imap.gmail.com
EMAIL_SMTP_HOST=smtp.gmail.com
# Security (recommended)
[email protected],[email protected]
# Optional
EMAIL_IMAP_PORT=993 # Default: 993 (IMAP SSL)
EMAIL_SMTP_PORT=587 # Default: 587 (SMTP STARTTLS)
EMAIL_POLL_INTERVAL=15 # Seconds between inbox checks (default: 15)
[email protected] # Default delivery target for cron jobs
hermes gateway # Run in foreground
hermes gateway install # Install as a user service
sudo hermes gateway install --system # Linux only: boot-time system service
On startup, the adapter:
The adapter polls the IMAP inbox for UNSEEN messages at a configurable interval (default: 15 seconds). For each new email:
[Subject: Deploy to production])Re:) skip the subject prefix — the thread context is already establishednoreply@, mailer-daemon@, bounce@, no-reply@, and emails with Auto-Submitted, Precedence: bulk, or List-Unsubscribe headersReplies are sent via SMTP with proper email threading:
Re: prefix (no double Re: Re:)The agent can send file attachments in replies. Include MEDIA:/path/to/file in the response and the file is attached to the outgoing email.
To ignore all incoming attachments (for malware protection or bandwidth savings), add to your config.yaml:
platforms:
email:
skip_attachments: true
When enabled, attachment and inline parts are skipped before payload decoding. The email body text is still processed normally.
Email access is stricter by default than chat-style platforms:
EMAIL_ALLOWED_USERS set → only emails from those addresses are processedEMAIL_ALLOW_ALL_USERS=true → any sender is accepted (use with caution)platforms.email.unauthorized_dm_behavior: pair → unknown senders receive a pairing code:::warning
Use a dedicated inbox and configure EMAIL_ALLOWED_USERS for normal operation. Email pairing is opt-in because shared inboxes often contain unrelated unread messages, and Hermes should not reply to those contacts by default.
:::
| Problem | Solution |
|---|---|
| "IMAP connection failed" at startup | Verify EMAIL_IMAP_HOST and EMAIL_IMAP_PORT. Ensure IMAP is enabled on the account. For Gmail, enable it in Settings → Forwarding and POP/IMAP. |
| "SMTP connection failed" at startup | Verify EMAIL_SMTP_HOST and EMAIL_SMTP_PORT. Check that your password is correct (use App Password for Gmail). |
| Messages not received | Check EMAIL_ALLOWED_USERS includes the sender's email. Check spam folder — some providers flag automated replies. |
| "Authentication failed" | For Gmail, you must use an App Password, not your regular password. Ensure 2FA is enabled first. |
| Duplicate replies | Ensure only one gateway instance is running. Check hermes gateway status. |
| Slow response | The default poll interval is 15 seconds. Reduce with EMAIL_POLL_INTERVAL=5 for faster response (but more IMAP connections). |
| Replies not threading | The adapter uses In-Reply-To headers. Some email clients (especially web-based) may not thread correctly with automated messages. |
:::warning
Use a dedicated email account. Don't use your personal email — the agent stores the password in .env and has full inbox access via IMAP.
:::
EMAIL_ALLOWED_USERS to restrict who can interact with the agent~/.hermes/.env — protect this file (chmod 600)| Variable | Required | Default | Description |
|---|---|---|---|
EMAIL_ADDRESS | Yes | — | Agent's email address |
EMAIL_PASSWORD | Yes | — | Email password or app password |
EMAIL_IMAP_HOST | Yes | — | IMAP server host (e.g., imap.gmail.com) |
EMAIL_SMTP_HOST | Yes | — | SMTP server host (e.g., smtp.gmail.com) |
EMAIL_IMAP_PORT | No | 993 | IMAP server port |
EMAIL_SMTP_PORT | No | 587 | SMTP server port |
EMAIL_POLL_INTERVAL | No | 15 | Seconds between inbox checks |
EMAIL_ALLOWED_USERS | No | — | Comma-separated allowed sender addresses |
EMAIL_HOME_ADDRESS | No | — | Default delivery target for cron jobs |
EMAIL_ALLOW_ALL_USERS | No | false | Allow all senders (not recommended) |