Talk to Claude AI via email. Powered by the Claude Agent SDK - like Claude Code, but over email.
- Agentic AI: Uses Claude Agent SDK for intelligent, multi-step reasoning
- Web Search: Agent can search the web for current information
- Conversation Threading: Maintains context across email replies
- BYOK or Subscribe: Use your own API key or subscribe for $20/mo
- Conversation History: View all past conversations in dashboard
npm installcp .env.example .envEdit .env with your credentials:
PORT=3000
JWT_SECRET=your-random-secret-key
BASE_URL=http://localhost:3000
# SendGrid - Get free account at https://sendgrid.com
SENDGRID_API_KEY=SG.xxx
SENDGRID_FROM_EMAIL=[email protected]
# Stripe - Get test keys at https://dashboard.stripe.com/test/apikeys
STRIPE_SECRET_KEY=sk_test_xxx
STRIPE_PUBLISHABLE_KEY=pk_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxx
STRIPE_PRICE_ID=price_xxx
# Anthropic - Get key at https://console.anthropic.com
ANTHROPIC_API_KEY=sk-ant-xxxIn Stripe Dashboard:
- Go to Products → Add Product
- Name: "ClaudeMail Subscription"
- Price: $20/month recurring
- Copy the Price ID to
STRIPE_PRICE_ID
npm startVisit http://localhost:3000
- Install Railway CLI:
npm i -g @railway/cli - Login:
railway login - Create project:
railway init - Add environment variables:
railway variables set KEY=value - Deploy:
railway up
docker build -t claudemail .
docker run -p 3000:3000 --env-file .env claudemail-
Add Domain to SendGrid
- Go to Settings → Sender Authentication
- Add and verify your domain
-
Set Up Inbound Parse
- Go to Settings → Inbound Parse
- Add Host:
yourdomain.com - URL:
https://your-app.railway.app/api/webhooks/email - Check "POST the raw, full MIME message"
-
Add MX Record
- Add MX record to your domain:
mx.sendgrid.netpriority 10
- Add MX record to your domain:
-
Test
- Send email to
[email protected] - Check your app logs
- Send email to
- Go to Developers → Webhooks
- Add endpoint:
https://your-app.railway.app/api/webhooks/stripe - Select events:
checkout.session.completedcustomer.subscription.updatedcustomer.subscription.deletedinvoice.payment_failed
- Copy webhook secret to
STRIPE_WEBHOOK_SECRET
- User registers on web dashboard
- User either:
- Subscribes for $20/month, or
- Adds their own Anthropic API key
- User sends email to
[email protected] - System identifies user by sender email
- Claude Agent SDK processes the request with:
- Multi-step reasoning
- Web search capability
- Conversation context
- Response sent back via email with thread ID
- Replies maintain conversation context
ClaudeMail maintains conversation context across email replies:
- Each new conversation gets a unique thread ID
- Thread ID is included in email subject:
Re: [abc123] Your question - Replying to an email continues the same conversation
- Agent remembers previous context for follow-up questions
This project uses the Claude Agent SDK (@anthropic-ai/claude-code) which provides:
- Agentic Processing: Multi-turn reasoning with up to 10 steps
- Tool Access: Web search and web fetch capabilities
- Streaming: Real-time response generation
- Error Handling: Graceful fallbacks for API issues
| Endpoint | Method | Description |
|---|---|---|
/api/register |
POST | Create account |
/api/login |
POST | Login |
/api/logout |
POST | Logout |
/api/me |
GET | Get current user |
/api/settings/api-key |
POST | Set API key |
/api/subscribe |
POST | Create Stripe checkout |
/api/cancel-subscription |
POST | Cancel subscription |
/api/conversations |
GET | Get conversation history |
/api/webhooks/email |
POST | SendGrid inbound webhook |
/api/webhooks/stripe |
POST | Stripe webhook |
/api/health |
GET | Health check |
- Backend: Node.js + Express (ES Modules)
- Database: SQLite (better-sqlite3)
- Email: SendGrid
- Payments: Stripe
- Auth: JWT + bcrypt
- AI: Claude Agent SDK (
@anthropic-ai/claude-code)
src/
├── server.js # Main Express server
├── db.js # SQLite database with threading support
├── auth.js # JWT authentication
├── stripe.js # Stripe payments
├── email.js # SendGrid integration with thread parsing
└── claude.js # Claude Agent SDK integration
public/
└── index.html # Web dashboard (SPA)
MIT