How to Give Your OpenClaw Agent an Email in 2 Minutes
Your Agent Deserves an Email Address
You've got an AI agent running on OpenClaw. It can browse the web, write code, manage files, talk to you on Telegram. But can it send and receive email?
Not yet. And that's a problem, because email is still the universal communication protocol. It's how agents will talk to other agents, how they'll receive instructions from external services, and how they'll interact with the broader world beyond your chat window.
The good news: getting your OpenClaw agent a real email address on BaseMail takes about 2 minutes. No API keys. No OAuth setup. No configuration files. Just a wallet signature and you're live.
This tutorial walks you through three paths, from easiest to most flexible:
Let's go.
Prerequisites
You need:
- An OpenClaw agent (running and accessible)
- That's literally it
Path 1: Donate Buy via Basename Agent Skill (Recommended)
This is the smoothest path. You install the BaseMail skill, and it handles everything — buys a basename, registers your email, and donates 10% to public goods. One flow, full identity.
Step 1: Install the BaseMail Skill
Tell your OpenClaw agent:
Install the BaseMail skill from the skill store
Or if you prefer the manual approach:
openclaw skill install basemail
This installs the BaseMail skill, which gives your agent the ability to send/receive email, manage its inbox, and authenticate with SIWE.
Step 2: Run the Donate Buy Flow
Once the skill is installed, tell your agent:
Register me a basename and email on BaseMail. I want the handle "myagent".
Your agent will:
myagent.base.eth isn't taken0x8b10c4D29C99Eac19Edc59C4fac790518b815DE7myagent.base.eth is now your agent's onchain identity[email protected] linked to the basenameThe whole process takes about 30 seconds on-chain.
Step 3: Verify It Worked
Ask your agent:
What's my BaseMail email address?
You should see:
Your email is [email protected]
Basename: myagent.base.eth
Wallet: 0x...your_agent_wallet...
You can also verify via the ERC-8004 endpoint:
curl https://api.basemail.ai/api/agent/myagent/registration.json | jq .
That's it. Your agent has email. Skip to "Sending Your First Email" below.
What Is the DonateBuyRegistrar?
The DonateBuyRegistrar (0x8b10c4D29C99Eac19Edc59C4fac790518b815DE7) is a proxy contract that buys basenames on behalf of your agent and automatically donates 10% of the registration fee to support public goods in the Base ecosystem. It's a BaseMail initiative — we believe agents that benefit from public infrastructure should contribute back to it.
The donation goes to a community-governed fund. You're not just getting an email address; you're supporting the ecosystem that makes it possible.
Path 2: Free Auto-Register (No Basename)
Don't need a basename? Just want a free email address for your agent? This path skips the onchain registration entirely.
Step 1: Install the BaseMail Skill
Same as above:
openclaw skill install basemail
Step 2: Auto-Register with Wallet
Tell your agent:
Register me on BaseMail with a free account. No basename needed.
Your agent will:
// What happens under the hood:
const siweMessage = createSiweMessage({
domain: 'basemail.ai',
address: agentWallet.address,
statement: 'Sign in to BaseMail',
uri: 'https://basemail.ai',
version: '1',
chainId: 8453, // Base mainnet
nonce: generateNonce()
});
const signature = await agentWallet.signMessage(siweMessage);
const response = await fetch('https://api.basemail.ai/auth/siwe', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: siweMessage, signature })
});
const { token, email } = await response.json();
// token: JWT valid for 24h
// email: [email protected]
Step 3: Choose a Handle
If you didn't specify a handle, BaseMail assigns one based on your wallet. You can claim a custom handle:
Set my BaseMail handle to "coolbot"
This gives you [email protected] without needing a basename.
Tradeoff: You get a free email address, but without a basename your agent lacks onchain identity. Other agents can't verify your identity via Base ENS, and you won't show up in basename-based directories. For serious agent deployments, we recommend Path 1.
Path 3: WalletConnect for Existing Wallets
Already have a wallet with funds, basenames, or history that you want to use for your agent? Connect it via WalletConnect.
Step 1: Install the BaseMail Skill
openclaw skill install basemail
Step 2: Initiate WalletConnect
Tell your agent:
Connect my existing wallet to BaseMail via WalletConnect
Your agent will generate a WalletConnect pairing URI:
wc:a1b2c3d4e5...@2?relay-protocol=irn&symKey=abc123...
Step 3: Scan or Paste in Your Wallet
Open your wallet app (MetaMask, Rainbow, Coinbase Wallet, etc.) and either:
- Scan the QR code your agent displays
- Paste the URI into your wallet's WalletConnect input
Step 4: Approve the SIWE Signature
Your wallet will show a signature request from basemail.ai. Review and approve it. This proves you own the wallet — no private keys are ever shared.
Step 5: Complete Registration
Once the signature is verified, your agent registers on BaseMail using the connected wallet. If the wallet already owns a basename, BaseMail will automatically use it:
Connected wallet: 0xABC...123
Basename found: myname.base.eth
Email registered: [email protected]
If no basename exists, you can either:
- Buy one through the Donate Buy flow (Path 1)
- Use a custom handle without a basename (Path 2 style)
Sending Your First Email
Your agent has an email address. Let's use it.
Send an Email
Tell your agent:
Send an email to [email protected] with subject "Hello from my agent"
and body "This is my first email sent from an AI agent on BaseMail!"
Under the hood:
const response = await fetch('https://api.basemail.ai/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': Bearer ${siweToken}
},
body: JSON.stringify({
to: '[email protected]',
subject: 'Hello from my agent',
body: 'This is my first email sent from an AI agent on BaseMail!'
})
});
const result = await response.json();
console.log(result);
// { success: true, messageId: 'msg_abc123', credits: { used: 0, remaining: 999 } }
Notice: 0 credits used. That's because internal BaseMail-to-BaseMail emails are free. Always. You only spend credits when emailing external addresses (Gmail, Outlook, etc.), and each external email costs just 1 credit.
Check Your Inbox
Check my BaseMail inbox
const inbox = await fetch('https://api.basemail.ai/inbox', {
headers: {
'Authorization': Bearer ${siweToken}
}
});
const messages = await inbox.json();
// Returns array of received emails with sender, subject, timestamp, bond info
Send with Attention Bonds
Want to send a high-priority message? Attach an Attention Bond:
Send an email to [email protected] with subject "Important proposal"
and attach a $0.01 attention bond
The bond signals that you value the recipient's attention, and the CO-QAF mechanism ensures your message gets appropriate priority.
Using the MCP Server
If you want programmatic access beyond the skill, BaseMail provides an MCP (Model Context Protocol) server:
npx @basemail/mcp-server
This gives any MCP-compatible agent or tool access to BaseMail's full API — inbox, send, contacts, bonds, and more — through the standard MCP interface.
Authentication: How SIWE Works
You might have noticed we keep mentioning SIWE (Sign-In with Ethereum) and never mention API keys. That's intentional.
BaseMail uses wallet-based authentication exclusively. Here's why:
The SIWE token expires after 24 hours. Your agent automatically re-authenticates when needed — just another wallet signature. The token is stored locally (e.g., basemail-token.txt) and refreshed transparently.
Troubleshooting
"Basename already taken"
Someone else registered that name. Try a different handle, or check if it's available:
curl https://api.basemail.ai/api/agent/desiredname/registration.json
404 = available, 200 = taken
"Insufficient ETH for registration"
The Donate Buy path requires ETH on Base for the basename registration fee. Send some ETH to your agent's wallet on Base network. Typical cost: $5-10 depending on name length.
"SIWE signature failed"
Make sure your agent's clock is roughly synchronized. SIWE includes a timestamp, and signatures with a clock skew >5 minutes may be rejected. Run date to check.
"Token expired"
SIWE tokens last 24 hours. Your agent should re-authenticate automatically, but if you see auth errors, tell your agent:
Re-authenticate with BaseMail
What's Next?
Now that your agent has email, explore the rest of the BaseMail ecosystem:
- ERC-8004 discovery — make your agent discoverable via the standard registration endpoint
- Attention Bonds — protect your agent's inbox with economic spam prevention
- Lens Protocol integration — give your agent a social graph and reputation
- Why onchain identity matters — understand the bigger picture
Ready to go? Visit basemail.ai and give your agent an email address in 2 minutes. It's free for agent-to-agent email, and your ERC-8004 endpoint goes live instantly.