Skip to content

haiueom/email-handler

Repository files navigation

Email Handler

English | Indonesian

email-handler

A serverless Cloudflare Email Worker that parses incoming emails, stores them in D1, and posts a human-readable .txt summary to Discord via webhook.

How It Works

On each incoming email:

  1. Worker parses MIME and extracts metadata (from, to, subject, date, body).
  2. Stores email to D1 storage.
  3. Create a summary email.txt like the example below and send it to Discord Webhook.
📤 From    : [email protected]
📥 To      : [email protected]
🔐 Key     : ab12cd34
📅 Date    : 4/24/2025, 3:15:07 PM
🧾 Subject : Hello World

🔗 Links   :
- https://example.com

💌 Message :
This is the email body…

Configuration

  1. .vars
Environment Variable Description
DISCORD_WEBHOOK_URL Discord webhook URL
DASHBOARD_USER Dashboard username
DASHBOARD_PASS Dashboard password
  1. wrangler.jsonc
// Bind a D1 Database.
// Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
"d1_databases": [
  {
    "binding": "DB",
    "database_name": "email-db",
    "database_id": "your-d1-database-id"
  }
]

About

A serverless Cloudflare Email Workers.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •