Skip to main content

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.

Built on the x402 protocol - every API call is paid with USDC on Base.

Install

pip install x402mail[cdp]

Quick Start

export CDP_API_KEY_ID="your-key-id"          # from cdp.coinbase.com
export CDP_API_KEY_SECRET="your-key-secret"
export CDP_WALLET_SECRET="your-wallet-secret"
from x402mail import X402Mail

mail = X402Mail.from_cdp()

mail.send(
    to="alice@example.com",
    subject="Hello from x402mail",
    body="Sent with 3 lines of Python!"
)

mail.inbox()
mail.messages(limit=5)
mail.read(message_id=1)

Or with a private key: X402Mail(private_key=os.getenv("EVM_PRIVATE_KEY"))

MCP Server for AI Agents

Run a local MCP server so LLMs (Claude, GPT, etc.) can send and receive emails:

x402mail mcp

Add to your MCP config (Claude Desktop / Cursor / Claude Code):

{
  "mcpServers": {
    "x402mail": {
      "command": "x402mail",
      "args": ["mcp"],
      "env": {
        "CDP_API_KEY_ID": "your-key-id",
        "CDP_API_KEY_SECRET": "your-key-secret",
        "CDP_WALLET_SECRET": "your-wallet-secret"
      }
    }
  }
}

MCP Tools

Tool Cost Description
send_email $0.005 Send an email to any address
get_inbox $0.001 Get your inbox address and message counts
list_messages $0.002 List inbox messages
read_message $0.001 Read a specific message

Pricing

Action Cost
Send email $0.005
Check inbox $0.001
List messages $0.002
Read message $0.001

$1 USDC covers ~200 emails.

Wallet Setup

CDP Server Wallet (recommended): Follow the CDP quickstart guide to get API keys. No private keys to manage.

Private Key: Use any EVM wallet with USDC on Base. pip install x402mail (without [cdp]).

Links

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

x402mail-0.2.5.tar.gz (169.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

x402mail-0.2.5-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file x402mail-0.2.5.tar.gz.

File metadata

  • Download URL: x402mail-0.2.5.tar.gz
  • Upload date:
  • Size: 169.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for x402mail-0.2.5.tar.gz
Algorithm Hash digest
SHA256 e3385fd7a2f5ba0e210dd1dce0757fd4d7ec6f6eea7e3fc4c0085e633472ac66
MD5 cc91689fe8a2292ebbf4126491594e97
BLAKE2b-256 ab11671238aebda531cbfdc5317626a6fd296dd90c137d9e6c47101d037cec1c

See more details on using hashes here.

File details

Details for the file x402mail-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: x402mail-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for x402mail-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5a459c3f94371a32b382bdd62bca9963f79cc30e2db736edcfaec0e627f8b51d
MD5 9db01e86c879359849c8c9e32556b8f2
BLAKE2b-256 5959498ee7a36c3e367e47351c5ef85ffb155b6d422c123e2534cc0f71b1370a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page