|
| 1 | +# Email Spam Filter |
| 2 | + |
| 3 | +A Cloudflare Worker for handling email auto-replies and forwarding. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Auto-replies to incoming emails |
| 8 | +- Forwards emails with subjects to a specified address |
| 9 | +- Customizable sender information and message content |
| 10 | + |
| 11 | +## Setup |
| 12 | + |
| 13 | +### Environment Variables |
| 14 | + |
| 15 | +This project uses environment variables to configure sender information, email addresses, and message content. This allows you to customize the behavior for different environments without committing sensitive information to git. |
| 16 | + |
| 17 | +#### Required Environment Variables |
| 18 | + |
| 19 | +Copy `.env.example` to `.env.local` and fill in your actual values: |
| 20 | + |
| 21 | +```bash |
| 22 | +cp .env.example .env.local |
| 23 | +``` |
| 24 | + |
| 25 | +Then edit `.env.local` with your values: |
| 26 | + |
| 27 | +- `SENDER_NAME`: Name displayed as the sender of auto-reply emails |
| 28 | +- `SENDER_EMAIL`: Email address used as the sender |
| 29 | +- `REPLY_EMAIL`: Email address used for replies (usually same as SENDER_EMAIL) |
| 30 | +- `FORWARD_EMAIL`: Email address where messages should be forwarded |
| 31 | +- `ORGANIZATION_NAME`: Organization name used in email message content |
| 32 | +- `WEBSITE_URL`: Website URL referenced in email messages |
| 33 | + |
| 34 | +#### Setting Environment Variables in Cloudflare |
| 35 | + |
| 36 | +For production deployment, set these environment variables in your Cloudflare Worker: |
| 37 | + |
| 38 | +```bash |
| 39 | +wrangler secret put SENDER_NAME |
| 40 | +wrangler secret put SENDER_EMAIL |
| 41 | +wrangler secret put REPLY_EMAIL |
| 42 | +wrangler secret put FORWARD_EMAIL |
| 43 | +wrangler secret put ORGANIZATION_NAME |
| 44 | +wrangler secret put WEBSITE_URL |
| 45 | +``` |
| 46 | + |
| 47 | +### Development |
| 48 | + |
| 49 | +1. Install dependencies: |
| 50 | + |
| 51 | + ```bash |
| 52 | + npm install |
| 53 | + ``` |
| 54 | + |
| 55 | +2. Set up environment variables (see above) |
| 56 | + |
| 57 | +3. Run locally: |
| 58 | + |
| 59 | + ```bash |
| 60 | + wrangler dev |
| 61 | + ``` |
| 62 | + |
| 63 | +### Deployment |
| 64 | + |
| 65 | +```bash |
| 66 | +wrangler deploy |
| 67 | +``` |
0 commit comments