GitHub - haiueom/email-handler: A serverless Cloudflare Email Workers.

Skip to content

Navigation Menu

Sign in

Appearance settings

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    : sender@example.com
๐Ÿ“ฅ To      : you@domain.com
๐Ÿ” 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