Python Agentmail Send & Receive for Openclaw

An AI-friendly Python skill for sending, receiving, and threading emails via the agentmail.to API using structured JSON data.

lausser
v1.0.0
Feb 28, 2026
0
970
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install python-agentmail-send-receive

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install python-agentmail-send-receive using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Python Agentmail Send & Receive?

This skill provides a specialized interface for AI agents to interact with email accounts through the agentmail.to service. Unlike traditional IMAP/SMTP setups, it uses a modern API that is highly compatible with automated workflows, allowing agents to process messages as structured JSON data.

By integrating this into Openclaw Skills, developers can grant their agents a persistent email identity to communicate with humans or other services. The skill handles the complexities of authentication and message formatting, enabling agents to focus on content processing and automated decision-making. It is specifically designed to be lightweight, using local Python scripts and environment variables for secure configuration.

Python Agentmail Send & Receive Use Cases

  • Automated customer support where an AI agent handles incoming inquiries via email.
  • Notifying human users of task completion or system alerts with automated outbound messages.
  • Processing incoming data, reports, or logs sent to a dedicated agent inbox.
  • Building human-in-the-loop systems where an agent requests clarification or approval via email threads.
  • Enabling cross-agent communication through a standardized email protocol.

How Python Agentmail Send & Receive Works

  1. The agent executes the check_mail.py script to fetch unread messages from the agentmail.to API.
  2. Unread messages are downloaded and saved into the local workspace as individual JSON files with a timestamped naming convention.
  3. The AI agent parses the JSON files to extract metadata such as sender, subject, and the plain-text or HTML body.
  4. To respond, the agent utilizes the send_email.py script or a custom reply function to maintain conversation threads via message IDs.
  5. Once processed, the agent can clean up the workspace by deleting the JSON files, ready for the next polling cycle.

Python Agentmail Send & Receive Setup

Deploy the Skill

Run the following commands to set up the workspace and install dependencies within Openclaw Skills:

DEST=~/.openclaw/workspace/agentmail
mkdir -p "$DEST"
# Copy scripts to the destination and navigate there
cd "$DEST"

# Create a virtual environment and install requirements
python3 -m venv venv
source venv/bin/activate
pip install agentmail python-dotenv

Configuration

Create a .env file in the workspace directory with your API key:

echo "AGENTMAIL_API_KEY=your_api_key_here" > ~/.openclaw/workspace/agentmail/.env

Python Agentmail Send & Receive Data Schema & Taxonomy

The skill organizes emails into local JSON files named MAIL.<TIMESTAMP>.<SEQUENCE>.

Key Description
message_id Unique identifier for the specific email.
thread_id Identifier used to group related messages.
from The sender's display name and email address.
subject The email subject line.
text The plain-text version of the email body.
html The HTML version of the email body.
labels Array of tags such as "received" or "unread".

Python Agentmail Send & Receive Advanced Features

  • Context-aware threading: Use the reply() method with a message_id to keep conversations organized in a single thread.
  • Robust error handling: Detailed exit codes (0-3) allow agents to diagnose API errors or missing credentials autonomously.
  • JSON-first architecture: Designed specifically for LLMs to easily parse and generate content without complex MIME handling.
  • Headless operation: Designed to run in CLI environments and containerized AI agent workflows within Openclaw Skills.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*