Back to Article List

Hermes Agent email gateway with IMAP and SMTP

Hermes Agent email gateway with IMAP and SMTP - Hermes Agent email gateway with IMAP and SMTP

Email gets undersold as an agent channel. People assume it's slow, formal and not worth wiring up when Telegram exists. They're missing the point. Email is the channel that handles forwarded receipts, automated reports, alerts from other systems and anything where you want a paper trail. An agent that reads your inbox is a much more interesting one than an agent that just answers DMs.

This guide covers the IMAP/SMTP setup for Hermes, the Gmail-specific app password dance you need until OAuth lands and the inbox filtering patterns that keep the agent from drowning when your inbox gets noisy.

Pick a dedicated email account first

Same advice as for WhatsApp: don't point the agent at your personal email. Three reasons.

The agent will read every incoming message, which means every message goes through your LLM provider. Your bank statements, your therapist's appointment confirmations, your dad's reply about Christmas plans. Even if the LLM provider is reputable, that's a privacy posture you don't want.

The agent will reply to messages it thinks merit a reply. By default, only to senders on your allowlist, but configuration mistakes happen. You don't want a misconfigured agent auto-replying to a real human you also email manually.

Email accounts are easier to lock down when they're dedicated. You can give the agent's account narrower OAuth scopes, route only specific senders to it via forwarding rules, even put it behind a separate domain so the bot's email address looks like a bot.

Get a fresh free account (Gmail, ProtonMail, FastMail, your own Postfix install if you're feeling ambitious). Use it only for the agent.

Gmail with app passwords

Gmail is the most common email backend for Hermes setups and Google's app-password flow is what you'll use until OAuth support lands.

Enable 2-Step Verification on the Google account first. App passwords aren't available without it. Go to myaccount.google.com, Security, 2-Step Verification, set it up.

Then visit myaccount.google.com/apppasswords directly. Generate an app password named something like "Hermes Agent". Google shows the password once; copy it now or you'll have to regenerate.

The app password is a 16-character string with no spaces (Google displays it with spaces for readability; strip them). It substitutes for your normal password in IMAP/SMTP auth.

In ~/.hermes/.env:

[email protected]
EMAIL_PASSWORD=abcd1234efgh5678
EMAIL_IMAP_HOST=imap.gmail.com
EMAIL_IMAP_PORT=993
EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=465

The 16-character app password goes into EMAIL_PASSWORD. Don't put your real Google account password there; it won't work even if 2FA is off, because Google requires app passwords for IMAP/SMTP access from third-party apps.

Set the allowed senders:

hermes config set messaging.email.allowed_senders '["[email protected]", "[email protected]"]'

The agent will read all incoming messages but only respond to ones from senders on this list. Messages from anyone else are silently ignored (or filed to a folder, depending on your messaging.email.unknown_sender_action setting).

Configure the polling interval:

hermes config set messaging.email.poll_interval_seconds 60

60 seconds is a sensible default. The bot checks for new messages every minute. Drop to 30 if you want faster response times; raise to 300 if you want fewer round-trips to the IMAP server.

Run the gateway:

hermes gateway start

Send the bot a test email from a sender on your allowlist. Within a minute, you should see a reply.

Other Gmail-flavoured providers

Several providers use Gmail-compatible IMAP/SMTP with their own hostnames:

Google Workspace: same hostnames as gmail.com, but use your Workspace email address.

FastMail: imap.fastmail.com:993, smtp.fastmail.com:465. App passwords via www.fastmail.com/settings/security.

ProtonMail: requires the Proton Mail Bridge running locally; once installed, the bridge exposes 127.0.0.1:1143 and 127.0.0.1:1025. The setup is more involved; the Hermes docs have the specific config snippet.

Apple iCloud Mail: imap.mail.me.com:993 with app-specific password. Apple requires 2FA on the Apple ID.

Self-hosted Postfix/Dovecot: whatever your server's TLS-enabled IMAP/SMTP ports are. The advantage of self-hosted is no third-party rate limits and no app-password dance; the disadvantage is you're now running an email server.

Inbox filters and folders

Out of the box, the agent reads everything from the INBOX folder. For a noisy inbox, you'll want to either filter at the email-server side or configure the agent to only read certain folders.

Server-side filtering, in Gmail: create filters that route specific senders to specific labels. The agent ignores anything not in INBOX (or whatever folder you've configured). Forward only the senders you want to give the agent attention to.

Hermes-side filtering, more flexible:

messaging:
  email:
    folders_to_poll: ["INBOX", "Agent-Tasks"]
    folders_to_ignore: ["Spam", "Promotions"]
    sender_patterns:
      - match: "*@github.com"
        action: respond
      - match: "*@example.com"
        action: respond
      - match: "newsletter@*"
        action: ignore

The patterns are evaluated in order; first match wins. Useful when you want the agent to handle GitHub notifications, work emails and personal mail differently.

What the agent does with email

By default, the agent treats each incoming email as a user message and replies in-thread (preserving the message-id headers so reply chains stay threaded in your client). The reply goes to the original sender; if the email was sent to multiple people, the bot replies only to the sender unless you configure reply-all behaviour.

For long emails (forwarded reports, document attachments), the agent reads the whole message including attachments. Attachments are saved to ~/.hermes/inbox/email/<message-id>/ for the agent to access via filesystem tools. PDFs get extracted to text via the Hermes PDF skill if it's enabled. Images get sent to vision-capable models.

For automated emails (alerts from monitoring systems, build notifications), you usually don't want the agent to reply at all. Configure no-reply behaviour for those:

messaging:
  email:
    no_reply_patterns:
      - "noreply@*"
      - "alerts@*"
      - "notifications@*"

The agent still reads these and stores them in memory but doesn't generate a response. Useful for ingesting alerts the agent should know about without spamming the alert sender with replies.

SMTP rate limits and Gmail-specific gotchas

Gmail's SMTP server has a 500 messages per day per account limit on free accounts and 2000 on Workspace. For most personal agents, this is plenty (a typical bot sends a few dozen messages a day). For a busy bot, watch out.

Gmail also has a 100-recipient-per-message limit. If your agent ever generates a multi-recipient email, the SMTP send fails with a 552 error. Hermes splits large recipient lists automatically, but it's worth knowing about.

If you hit Gmail's limits, the failure mode is "send temporarily blocked"; you typically get a few hours' cooldown before sends work again. Don't retry aggressively or Google may flag the account.

Outbound-only configurations

Sometimes you want the agent to send emails (a daily summary, an alert) without exposing it to incoming mail. Configure SMTP only:

messaging:
  email:
    mode: outbound_only
    smtp_host: smtp.gmail.com
    smtp_port: 465
    smtp_user: [email protected]
    smtp_password: "your-app-password"
    from_address: "Hermes Bot <[email protected]>"

The agent can call the send_email tool from any skill or chat session. Useful for sending nightly reports to yourself based on what the agent saw during the day or for routing async results from long-running tasks back to your inbox.

Troubleshooting

If the agent never sees any incoming messages despite emails arriving in the inbox, check IMAP connectivity:

openssl s_client -connect imap.gmail.com:993 -crlf
# After connection, type:
a1 LOGIN [email protected] your-app-password

If LOGIN succeeds with an "OK" response, your credentials are right. If it fails, the password is wrong (most likely, the spaces in your app password didn't get stripped before pasting).

If IMAP works but the agent still doesn't process incoming mail, check the polling interval and the folders_to_poll config. The default is INBOX; if you've moved emails to a different label and Gmail's "Inbox" no longer includes them, the agent doesn't see them.

If outbound mail goes out but the recipient never gets it, check Gmail's "Sent" folder via the web UI. If it's not there, the SMTP send failed silently (rare). If it is there, the recipient's mail server is rejecting it; check spam folders. Bot-generated email goes to spam more often than human email; SPF, DKIM and DMARC records on your sending domain help if you have a custom domain.

Email plus the other channels

Email pairs nicely with chat platforms via the channel-routing patterns covered in the multi-platform gateway article. Common patterns:

Forward an email to the agent, get a Telegram reply with the summary. The agent reads the email, processes it, replies via your preferred chat channel. Useful for quick triage of forwarded items.

Ask the agent on Telegram to draft an email, the agent generates the message and sends it via SMTP. Useful for "send a polite refusal to that intern who keeps emailing me about their startup".

Cron skills that pull data from one source and email a report on a schedule. The agent runs the cron, generates the email, sends it. The OpenClaw cron scheduler guide covers the equivalent on the OpenClaw side; Hermes uses the same general pattern.

If you'd like the install done for you

The LumaDock Hermes Agent VPS template ships with the IMAP/SMTP libraries pre-installed; you only need to drop your credentials into .env and configure folders. The default settings handle Gmail and most third-party hosts without further tuning.

Your idea deserves better hosting

24/7 support 30-day money-back guarantee Cancel anytime
Billing Cycle

1 GB RAM VPS

14.38 zł Save  25 %
10.78 Monthly
  • 1 vCPU AMD EPYC
  • 30 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Firewall management
  • Free server monitoring

2 GB RAM VPS

21.59 zł Save  17 %
17.98 Monthly
  • 2 vCPU AMD EPYC
  • 30 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Firewall management
  • Free server monitoring

6 GB RAM VPS

54.02 zł Save  33 %
36.00 Monthly
  • 6 vCPU AMD EPYC
  • 70 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P1

28.79 zł Save  25 %
21.59 Monthly
  • 2 vCPU AMD EPYC
  • 4 GB RAM memory
  • 40 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P2

54.02 zł Save  27 %
39.61 Monthly
  • 2 vCPU AMD EPYC
  • 8 GB RAM memory
  • 80 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P4

108.08 zł Save  20 %
86.45 Monthly
  • 4 vCPU AMD EPYC
  • 16 GB RAM memory
  • 160 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P5

131.50 zł Save  21 %
104.47 Monthly
  • 8 vCPU AMD EPYC
  • 16 GB RAM memory
  • 180 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P6

205.38 zł Save  21 %
162.13 Monthly
  • 8 vCPU AMD EPYC
  • 32 GB RAM memory
  • 200 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

AMD EPYC VPS.P7

252.23 zł Save  20 %
201.77 Monthly
  • 16 vCPU AMD EPYC
  • 32 GB RAM memory
  • 240 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

EPYC Genoa VPS.G1

17.98 zł Save  20 %
14.38 Monthly
  • 1 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture.
  • 1 GB DDR5 memory
  • 25 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

EPYC Genoa VPS.G2

46.81 zł Save  23 %
36.00 Monthly
  • 2 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture.
  • 4 GB DDR5 memory
  • 50 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

EPYC Genoa VPS.G4

93.66 zł Save  27 %
68.44 Monthly
  • 4 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture.
  • 8 GB DDR5 memory
  • 100 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

EPYC Genoa VPS.G6

176.55 zł Save  31 %
122.49 Monthly
  • 8 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture.
  • 16 GB DDR5 memory
  • 200 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

EPYC Genoa VPS.G7

270.24 zł Save  27 %
198.17 Monthly
  • 8 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4th generation 9xx4 with 3.25 GHz or similar, on Zen 4 architecture.
  • 32 GB DDR5 memory
  • 250 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

1 vCPU AMD Ryzen 9

50.42 zł Save  29 %
36.00 Monthly
  • Dedicated CPU 4.5GHz AMD Ryzen 9 7950X with a native CPU frequency of 4.5 GHz.
  • 4 GB DDR5 memory
  • 50 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

2 vCPU AMD Ryzen 9

93.66 zł Save  19 %
75.64 Monthly
  • Dedicated CPU 4.5 GHz AMD Ryzen 9 7950X with a native frequency of 4.5 GHz.
  • 8 GB DDR5 memory
  • 100 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

8 vCPU AMD Ryzen 9

335.11 zł Save  30 %
234.21 Monthly
  • Dedicated CPU 4.5 GHz AMD Ryzen 9 7950X with a native frequency of 4.5 GHz.
  • 32 GB DDR5 memory
  • 400 GB NVMe storage
  • Unmetered bandwidth
  • IPv4 & IPv6 included IPv6 support is currently unavailable in France, Finland or the Netherlands.
  • 1 Gbps network
  • Automatic backup included
  • Firewall management
  • Free server monitoring

FAQ

How do I keep the agent from replying to spam that gets through Gmail's filter?

Two layers. Server-side: tighten Gmail's filtering. Hermes-side: the allowlist on messaging.email.allowed_senders gives you the strictest filter. Anything not from an allowlisted sender gets logged but never replied to. If the allowlist feels too restrictive (you do want the agent to handle some unknown senders, like one-off contacts), the middle ground is to set messaging.email.unknown_sender_action: archive; the agent reads the message and stores it for context but doesn't reply. You can ask the agent later "did anything come in from new senders today" and it can tell you.

Your agent runs wild. Your bill doesn't.

Easily deploy Hermes in one click on Ubuntu 24.04 with AMD EPYC, NVMe storage and unmetered bandwidth. The price stays the same whatever the agent does, no setup fees, no overage charges and no tier traps.

GPU products are in high demand at the moment. Fill the form to get notified as soon as your preferred GPU server is back in stock.