FEDL Email Worker
Handles incoming emails and can send emails using Cloudflare Workers Email.
Setup
1. Configure Email Routing (Cloudflare Dashboard)
- Go to Email → Email Routing in Cloudflare Dashboard
- Select your domain fedl.site
- Add an email address:
[email protected] - Create a routing rule:
- When: A message is sent to
[email protected] - Then: Route to Worker →
fedl-email-worker
- When: A message is sent to
2. Deploy the Worker
cd worker
npm install
npx wrangler deploy
3. Configure Worker Bindings
In wrangler.jsonc, add:
{
"name": "fedl-email-worker",
"main": "src/index.ts",
"compatibility_date": "2024-01-01",
"vars": {
"FORWARD_TO": "[email protected]"
}
}
4. Environment Variables
| Variable | Purpose |
|---|---|
FORWARD_TO |
Email address to forward incoming emails to |
SEND_EMAIL |
Cloudflare Email binding (auto-configured) |
API Endpoints
Send Email
POST /send
Content-Type: application/json
{
"to": "[email protected]",
"subject": "Password Reset",
"text": "Click here to reset: ..."
}
Update wrangler.jsonc for Cloudflare Pages/Workers
Make sure your wrangler.jsonc has the email binding configured in the Cloudflare dashboard under Workers & Pages → your worker → Settings → Variables.