Send and receive emails with crypto micropayments via x402
Project description
x402mail
Send and receive emails with crypto micropayments. No accounts, no API keys — just a wallet.
Install
pip install x402mail
Quick Start
from x402mail import X402Mail
mail = X402Mail(private_key="0x...")
# Send an email ($0.005 USDC)
result = mail.send(
to="alice@example.com",
subject="Hello from web3",
body="Sent via x402 micropayment!"
)
print(result)
# {"message_id": "abc-123", "inbox": "inbox-0x1a2b...@x402mail.com"}
# Check your inbox ($0.001)
inbox = mail.inbox()
print(inbox)
# {"address": "inbox-0x1a2b...@x402mail.com", "total": 5, "unread": 2}
# List messages ($0.002)
messages = mail.messages(limit=5, unread_only=True)
# Read a message ($0.001)
msg = mail.read(message_id=1)
print(msg["body"])
MCP Server for AI Agents
Run a local MCP server so LLMs (Claude, GPT, etc.) can send/receive emails:
x402mail mcp
Claude Desktop / Cursor Setup
Add to your MCP config:
{
"mcpServers": {
"x402mail": {
"command": "x402mail",
"args": ["mcp"],
"env": {
"X402MAIL_PRIVATE_KEY": "0x_your_private_key_here"
}
}
}
}
Or without installing (using uvx):
{
"mcpServers": {
"x402mail": {
"command": "uvx",
"args": ["x402mail", "mcp"],
"env": {
"X402MAIL_PRIVATE_KEY": "0x_your_private_key_here"
}
}
}
}
Available Tools
| Tool | Cost | Description |
|---|---|---|
send_email |
$0.005 | Send an email |
get_inbox |
$0.001 | Get inbox address + counts |
list_messages |
$0.002 | List inbox messages |
read_message |
$0.001 | Read a specific message |
How It Works
- You provide your Ethereum private key (for signing payments)
- Each API call is paid via x402 micropayments in USDC on Base
- Your wallet address = your identity. No accounts needed.
- Your inbox address is derived from your wallet:
inbox-{wallet}@x402mail.com
Pricing
All prices are in USDC on Base (mainnet). Sending one email costs half a cent.
Requirements
- Python 3.10+
- An Ethereum wallet with USDC on Base
- A funded wallet (even $1 USDC covers ~200 emails)
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file x402mail-0.1.0.tar.gz.
File metadata
- Download URL: x402mail-0.1.0.tar.gz
- Upload date:
- Size: 168.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f210cfdb79c8fd92964c2851973247842658efed35cc5bd2f1506a83bcc17128
|
|
| MD5 |
4c734914f3ac3a2ea3e72747473eb5aa
|
|
| BLAKE2b-256 |
67b0027d6fb95700f44af1775dd40a4c2d6fdf0c585d5c9549974af8290fe11d
|
File details
Details for the file x402mail-0.1.0-py3-none-any.whl.
File metadata
- Download URL: x402mail-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f0649fb338c9296acac135dd0934adfd09ab3bb5d1885350e0052bc0814f2d0
|
|
| MD5 |
7f9319c88c7f48eb9645029b58c921ef
|
|
| BLAKE2b-256 |
92e36c3e6a23944f7f13112bd70a6deaa632f6178308431922bb8587b0be702e
|