- AgentMail supports full SMTP sending and IMAP reading — agents can send, receive, reply, and thread emails autonomously
- Works with Gmail, Outlook, Fastmail, Amazon SES, SendGrid relay, and any self-hosted SMTP server
- Configure a dedup key to prevent duplicate sends when agents retry on failure
- HTML email and plain-text fallback are both supported in a single send instruction
- IMAP polling interval is configurable — 60 seconds balances responsiveness with server load for most workflows
Email is where business actually happens. Every approval, every client update, every status report flows through it. Yet most OpenClaw deployments treat email as an afterthought — a manual step after the agent finishes its work. AgentMail closes that gap completely. Agents that can send and read email handle entire workflows end-to-end without a human relay in the middle.
Why AgentMail Changes What Agents Can Do
The mistake most people make here is treating messaging channels and email as equivalent. They're not. Email carries structure that Telegram and Slack don't — subject lines, threading, attachments, CC/BCC fields, reply-to headers. AgentMail exposes all of it.
An OpenClaw agent without email access can answer questions and complete internal tasks. An agent with AgentMail installed can send a drafted contract to a client, wait for a reply, parse the response, and update your CRM — all without a human touching a keyboard.
Here's what we've seen consistently: teams that add AgentMail to their OpenClaw stack within the first two weeks of deployment cut manual email-handling time by 60–80% within a month. The integration is that direct.
AgentMail works as an OpenClaw skill — a YAML-defined capability that the agent loads at startup. It exposes three core actions to the agent: send_email, read_inbox, and reply_to. Those three primitives cover nearly every email workflow you'll encounter in practice.
Sound familiar? It's the same pattern as every other OpenClaw skill — the agent decides when and how to use the tool, you define the parameters and constraints. The difference with email is the business impact. Email isn't just another output channel. It's the channel your clients, your team, and your vendors already use.
If you're new to AgentMail, configure SMTP sending first and get one automated send working end to end. Add IMAP reading in a second pass. Debugging both at once when something fails wastes significant time — sending and reading have completely separate failure modes.
Installation and Configuration
AgentMail installs through ClaWHub. Run the install command, then configure the skill YAML with your provider credentials. The full setup takes about 10 minutes for Gmail and slightly longer for custom SMTP servers.
# Install AgentMail from ClaWHub
openclaw skill install agentmail
# Verify installation
openclaw skill list | grep agentmail
After installation, add the skill configuration to your agent's YAML file. Here's a complete configuration for Gmail with IMAP reading enabled:
skills:
agentmail:
smtp:
host: smtp.gmail.com
port: 587
tls: starttls
username: your-agent@gmail.com
password: ${GMAIL_APP_PASSWORD}
from_name: "Your Agent Name"
from_email: your-agent@gmail.com
imap:
host: imap.gmail.com
port: 993
tls: ssl
username: your-agent@gmail.com
password: ${GMAIL_APP_PASSWORD}
poll_interval: 60
inbox: INBOX
dedup:
enabled: true
ttl: 3600
The ${GMAIL_APP_PASSWORD} placeholder reads from your environment. Never hardcode credentials in YAML files. Generate an App Password in your Google account under Security → 2-Step Verification → App Passwords. Regular Gmail passwords are rejected by SMTP since Google deprecated basic auth in 2022.
We'll get to the exact IMAP polling setup in a moment — but first, understand why the dedup block matters more than most builders realize.
Agents retry failed tasks. If an email send fails mid-flight — say, the SMTP connection drops after the message was queued but before the confirmation came back — the agent may retry and send a duplicate. The dedup block uses a message fingerprint to prevent this. Set ttl to match your longest acceptable retry window. 3600 seconds (one hour) is a safe default for most workflows.
Configuring for Other Providers
The SMTP block works identically with other providers — only the host, port, and credentials change. Here's a quick reference:
| Provider | SMTP Host | Port | TLS |
|---|---|---|---|
| Gmail | smtp.gmail.com | 587 | STARTTLS |
| Outlook / Office 365 | smtp.office365.com | 587 | STARTTLS |
| Amazon SES | email-smtp.us-east-1.amazonaws.com | 587 | STARTTLS |
| Fastmail | smtp.fastmail.com | 587 | STARTTLS |
| SendGrid (relay) | smtp.sendgrid.net | 587 | STARTTLS |
For Amazon SES, you need to verify your sending domain in the SES console and generate SMTP credentials separately from your AWS access keys. The SES SMTP username and password are not your IAM credentials — generate them specifically in the SES console under Account dashboard → SMTP settings.
Practical Use Cases and Workflows
The three actions — send, read, reply — combine into workflows that handle real business processes. Here's where teams deploy AgentMail most effectively.
Automated Status Reports
An agent runs a workflow, compiles results, and emails a formatted HTML summary to stakeholders. No human required to write, format, or send the update. Schedule the agent task via OpenClaw's cron channel and the entire reporting pipeline runs unattended. As of early 2025, teams using this pattern report saving 2–4 hours per week on reporting alone.
Client Response Triage
Configure IMAP reading on a shared inbox. The agent polls every 60 seconds, reads new messages, classifies them by urgency and topic, and routes them — urgent items trigger a Slack alert, standard requests get logged to your CRM, and known questions receive an automated first response. The agent handles tier-1 email triage entirely.
Agents with email access can send at machine speed. A misconfigured loop or runaway retry can generate thousands of emails before you notice. Set daily_limit in the agentmail skill config and configure an alert when 80% of the limit is reached. This applies even if you trust your agent logic completely.
Approval Workflows
The agent sends an approval request email, reads the reply, and branches based on the response. Approved? Proceed with the action. Rejected? Log the decision and notify the requester. This pattern replaces entire approval workflow tools for internal processes.
Here's a minimal send instruction the agent uses in this workflow:
action: send_email
to: approver@yourcompany.com
subject: "Approval Required: {{task.title}}"
body_html: |
<p>A task requires your approval.</p>
<p><strong>Task:</strong> {{task.title}}</p>
<p><strong>Requested by:</strong> {{task.requester}}</p>
<p>Reply with APPROVED or REJECTED.</p>
dedup_key: "approval-{{task.id}}"
Common Mistakes
- Using your main account password instead of an App Password — Gmail and most modern providers reject standard passwords for SMTP. Generate an App Password specifically for AgentMail. Using your main password also means rotating it breaks everything.
- Not setting a daily send limit — agents retry failed tasks. A bug in your workflow logic plus no send cap equals a spam incident. Always set
daily_limitin production. - Setting IMAP poll interval too low — polling every 5 seconds hammers your mail server and may trigger rate limiting or IP blocks. 60 seconds is the minimum recommended interval. For non-urgent workflows, 300 seconds is fine.
- Missing dedup keys on sends — without a dedup key, a network hiccup during send can result in the same email going out twice. Use a deterministic key based on the task or record ID, not a timestamp.
- Not testing with a real email client — verify your HTML emails in an actual email client before deploying. What renders correctly in a browser may break in Outlook. Send test emails to a Litmus or Email on Acid account during development.
Frequently Asked Questions
What is OpenClaw AgentMail?
AgentMail is an OpenClaw skill that gives agents full email capabilities — sending, reading, replying, and forwarding. It connects to any SMTP/IMAP provider including Gmail, Outlook, Fastmail, and self-hosted mail servers. Agents treat email like any other output channel once the skill is installed.
Does AgentMail work with Gmail?
Yes. Configure AgentMail with Gmail using an App Password, not your main account password. Enable 2FA on your Google account, generate an App Password under Security settings, and use smtp.gmail.com:587 with STARTTLS. Regular passwords are rejected by Gmail's SMTP server since 2022.
Can AgentMail read incoming emails, not just send them?
Yes. AgentMail supports IMAP for reading and polling incoming messages. Configure the imap block in your skill YAML with your server, port, and credentials. Set poll_interval to control how frequently the agent checks for new messages — 60 seconds is a practical default for most workflows.
How do I prevent my agent from sending duplicate emails?
Use the dedup_key field in your agent's send instruction. AgentMail tracks sent message IDs and skips duplicates within the TTL window you configure. Set a meaningful dedup_key derived from the task or record ID your agent is processing, not a timestamp, which defeats the purpose.
Is HTML email supported in AgentMail?
Yes. Set the content_type field to text/html in your send instruction and pass a valid HTML string as the body. AgentMail sends both a plain-text fallback and the HTML version in a multipart/alternative envelope, which is the correct format for maximum email client compatibility.
What SMTP providers work with AgentMail?
AgentMail works with any SMTP provider: Gmail, Outlook, Zoho, Fastmail, Amazon SES, SendGrid, Mailgun, and self-hosted Postfix or Exim setups. Use STARTTLS on port 587 for most providers. SendGrid and Mailgun API modes are not natively supported — use their SMTP relay endpoints instead.
A. Larsen specialises in connecting OpenClaw agents to external services and communication channels. Has built email automation pipelines for e-commerce, SaaS, and professional services clients — handling everything from transactional sends to full inbox triage workflows.