Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webbertakken/email-worker
Lightweight tool to process emails directly from Cloudflare
https://github.com/webbertakken/email-worker
cloudflare-workers discord email email-forwarding email-worker
Last synced: about 11 hours ago
JSON representation
Lightweight tool to process emails directly from Cloudflare
- Host: GitHub
- URL: https://github.com/webbertakken/email-worker
- Owner: webbertakken
- License: mit
- Created: 2023-02-22T19:04:37.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-09T12:10:50.000Z (17 days ago)
- Last Synced: 2024-12-18T13:05:42.451Z (8 days ago)
- Topics: cloudflare-workers, discord, email, email-forwarding, email-worker
- Language: TypeScript
- Homepage:
- Size: 359 KB
- Stars: 57
- Watchers: 3
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Email worker ยท [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/webbertakken/email-worker/blob/main/LICENSE) [![codecov](https://codecov.io/gh/webbertakken/email-worker/branch/main/graph/badge.svg?token=vWf0M5qX20)](https://codecov.io/gh/webbertakken/email-worker) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/webbertakken/email-worker/blob/main/CONTRIBUTING.md)
Send emails to Cloudflare and forward them to different channels using an email worker.
## Setup
#### Prerequisites
- Cloudflare [account](https://dash.cloudflare.com/sign-up) (free)
- Wrangler installed [globally](https://developers.cloudflare.com/workers/wrangler/install-and-update/#install-wrangler-globally)#### Install dependencies
```bash
yarn install
```#### Deploy the worker
```bash
yarn deploy
```#### Set up a webhook
- Right-click on a Discord channel then click `Edit Channel`, then `Integrations`.
- Create a webhook, then copy the URL.
- Add this url to your secrets:```bash
wrangler secret put DISCORD_WEBHOOK_URL
```You should see something like this
```console
๐ Creating the secret for the Worker "email-worker"
โจ Success! Uploaded secret DISCORD_WEBHOOK_URL
```#### Set up a route
- Go to your [zone's Email Workers settings](https://dash.cloudflare.com/?to=/:account).
- Click the zone (e.g. `example.com`), then `Email`, `Email Routing`.
- On the `Email Workers` tab, register an email route.[![Register an email route](./assets/email-routing.png)](./assets/email-routing.png)
#### Verify
- Send an email to the email address you registered.
- Check the channel you registered the webhook to.## Tips
- Change the `name` field in `wrangler.toml` to deploy a separate worker with a separate secret (e.g. with a separate webhook for a test channel).
## License
This package is [MIT](./LICENSE) licensed.
#### Sub licenses
- [`mat-sz/letterparser`](https://github.com/mat-sz/letterparser): [BSD-3 Clause Clear](https://github.com/mat-sz/letterparser/blob/master/LICENSE)