The worker is deployed! Just complete these 2 quick steps in the Cloudflare dashboard:
- Open: https://dash.cloudflare.com/
- Click on domain: offloadmy.work
- Left sidebar → DNS → Records
- Click Add record
- Fill in:
- Type:
AorAAAA - Name:
email - IPv4/IPv6: Use Cloudflare's worker proxy (auto-configured)
- Proxy status: ✅ Proxied (orange cloud)
- Type:
- Click Save
Note: The route
email.offloadmy.work/*is already configured in the worker. DNS just makes it accessible.
- Still in Cloudflare dashboard for offloadmy.work
- Left sidebar → Email → Email Routing
- If not enabled: Click Enable Email Routing and follow prompts
- Go to Email Workers or Routes tab
- Click Create route or Add rule
- Fill in:
- Rule name:
Catch-all to worker - When email is received: Choose Catch-all or type
*@offloadmy.work - Then: Select Send to Worker
- Worker: Select
offload-emailfrom dropdown
- Rule name:
- Click Save or Create
✅ Done! Your email worker is now live.
cd /Users/netanelgilad/development/offload-email-worker
./test-api.shShould output stats and list emails.
Send an email from your personal email to:
test@offloadmy.work
Subject: "Testing my new email worker" Body: "Hello from Cloudflare!"
export API_TOKEN=$(cat ~/.config/offload/email-worker.json | grep api_secret | cut -d'"' -f4)
curl -H "Authorization: Bearer $API_TOKEN" \
https://email.offloadmy.work/api/emails | jq '.emails[0]'You should see your test email! 🎉
Get your API token:
export API_TOKEN=$(cat ~/.config/offload/email-worker.json | grep api_secret | cut -d'"' -f4)List all emails:
curl -H "Authorization: Bearer $API_TOKEN" \
https://email.offloadmy.work/api/emailsGet stats:
curl -H "Authorization: Bearer $API_TOKEN" \
https://email.offloadmy.work/api/statsList only unread:
curl -H "Authorization: Bearer $API_TOKEN" \
"https://email.offloadmy.work/api/emails?unread=true"Mark email as read:
# Replace EMAIL_ID with actual ID from list
curl -X PATCH \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"read": true}' \
https://email.offloadmy.work/api/emails/EMAIL_ID# Deploy changes
npm run deploy
# View live logs
npm run tail
# Local development
npm run dev
# Query database
npm run db:remote "SELECT COUNT(*) FROM emails"- Full API docs:
README.md - Deployment details:
DEPLOY_LOG.md - Troubleshooting:
DEPLOY_LOG.md→ "🐛 Troubleshooting" section
Your email worker is now:
- ✅ Receiving emails at
*@offloadmy.work - ✅ Storing them in D1 database
- ✅ Exposing them via REST API
- ✅ Protected with authentication
- ✅ CORS-enabled for web apps
Build something cool! 🚀