Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

jmail

jmail

Free Disposable Temp Mail on Cloudflare Workers

Deployed on Workers License: MIT Built with Hono


jmail is a free, self-hosted disposable email service that runs entirely on Cloudflare Workers. No VPS, no Postfix, no Docker. It receives inbound email via Cloudflare Email Routing, stores messages in D1 (SQLite), and serves a clean web UI from the edge.

Live demo: mail.atiku.web.id


Features

  • Anonymous sessions β€” no sign-up, no tracking. Each browser gets its own isolated session via localStorage.
  • Auto-sync 5s β€” messages appear automatically without manual refresh.
  • Multi-domain β€” configure multiple mail domains (e.g. atiku.web.id, lalekne.web.id).
  • Ads-ready β€” optional AdSense slots (header/inlist/footer) or custom HTML ad injection. Disabled by default.
  • Theme customization β€” 5 CSS variable overrides via env vars. No code changes needed.
  • Vanilla JS frontend β€” zero framework dependencies. Just HTML, CSS, and plain JavaScript.
  • Zero dependencies beyond Hono + PostalMime β€” minimal supply chain.
  • Runs on Cloudflare free tier β€” Workers, D1, Email Routing, all free.

Quick Start

1. Clone & install

git clone https://github.com/josskixg/jmail.git
cd jmail
npm install

2. Login to Cloudflare

npx wrangler login

3. Configure environment variables

Edit wrangler.toml and fill in your values. See Configuration for all variables.

4. Create the D1 database

npx wrangler d1 create jmail-db

Copy the database_id into your wrangler.toml, then apply the schema:

npx wrangler d1 execute jmail-db --remote --file=src/db/schema.sql

5. Deploy

npx wrangler deploy

Set up Email Routing on your domain to start receiving emails.


Configuration

All environment variables are set in wrangler.toml under [vars].

App Settings

Variable Type Default Description
APP_NAME string "jmail" Display name shown in the UI
MAIL_DOMAIN string "atiku.web.id" Comma-separated list of allowed mail domains
WEB_HOST string "mail.atiku.web.id" Hostname of the web frontend
TAGLINE string "Free Disposable Temporary Email & Anonymous Inbox" Tagline below the app name
FOOTER_TEXT string "CREATED BY JMail" Footer attribution text

SEO Meta

Variable Type Default Description
META_KEYWORDS string "jmail, temp mail, ..." Content for <meta name="keywords">
META_AUTHOR string "JMAIL" Content for <meta name="author">

Ads (disabled by default)

Variable Type Default Description
ADS_ENABLED string "false" Set "true" to enable ad slots
ADS_CLIENT string "" AdSense publisher ID (e.g. ca-pub-1234567890)
ADS_SLOT_HEADER string "" AdSense slot ID for header
ADS_SLOT_INLIST string "" AdSense slot ID between inbox rows
ADS_SLOT_FOOTER string "" AdSense slot ID for footer
ADS_CUSTOM_HEADER string "" Custom HTML/JS for header ad (overrides AdSense)
ADS_CUSTOM_INLIST string "" Custom HTML/JS for in-list ad (overrides AdSense)
ADS_CUSTOM_FOOTER string "" Custom HTML/JS for footer ad (overrides AdSense)

Theme (optional)

Leave empty to use the default flower theme. Each value maps to a CSS custom property.

Variable CSS Property Controls
THEME_BG --bg-canvas Background color
THEME_PRIMARY --pink-flower Primary brand color
THEME_PRIMARY_SOFT --pink-soft Primary color lighter shade
THEME_ACCENT --yellow-flower Accent/secondary color
THEME_ACCENT_SOFT --yellow-soft Accent color lighter shade

Example Palettes

Cyberpunk:

THEME_BG = "#0a0a0f"
THEME_PRIMARY = "#ff2d95"
THEME_PRIMARY_SOFT = "#ff2d9533"
THEME_ACCENT = "#00f0ff"
THEME_ACCENT_SOFT = "#00f0ff33"

Forest:

THEME_BG = "#0f1a0f"
THEME_PRIMARY = "#2d8a4e"
THEME_PRIMARY_SOFT = "#2d8a4e33"
THEME_ACCENT = "#c4a35a"
THEME_ACCENT_SOFT = "#c4a35a33"

Project Structure

jmail/
β”œβ”€β”€ wrangler.toml
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── src/
    β”œβ”€β”€ index.ts                          # Entry point: fetch() + email() handlers
    β”œβ”€β”€ config/
    β”‚   β”œβ”€β”€ defaults.ts                   # Default config values
    β”‚   └── index.ts                      # Config/env loading
    β”œβ”€β”€ api/
    β”‚   β”œβ”€β”€ routes.ts                     # Hono router combining all API modules
    β”‚   β”œβ”€β”€ config.ts                     # GET /api/config
    β”‚   β”œβ”€β”€ session.ts                    # GET /api/session
    β”‚   β”œβ”€β”€ inboxes.ts                    # GET/POST /api/inboxes, DELETE /api/inboxes/:address
    β”‚   β”œβ”€β”€ messages.ts                   # GET /api/inboxes/:address/messages
    β”‚   β”œβ”€β”€ system.ts                     # GET /api/stats, GET /api/health
    β”‚   └── helpers.ts                    # Shared types and middleware
    β”œβ”€β”€ email/
    β”‚   └── handler.ts                    # PostalMime β†’ D1 email parser
    β”œβ”€β”€ db/
    β”‚   β”œβ”€β”€ schema.sql                    # D1 table definitions
    β”‚   └── queries.ts                    # Typed query functions
    β”œβ”€β”€ utils/
    β”‚   └── random-address.ts             # Human-like random email generator
    └── web/
        β”œβ”€β”€ index.html                    # Frontend UI
        β”œβ”€β”€ styles.css                    # Dark theme styles
        β”œβ”€β”€ docs.html                     # In-app API docs page
        β”œβ”€β”€ icon.svg                      # App icon
        β”œβ”€β”€ og-image.png                  # Open Graph preview image
        └── js/
            β”œβ”€β”€ app.js                    # Main app logic
            β”œβ”€β”€ api.js                    # API client wrapper
            β”œβ”€β”€ config.js                 # Config fetching/caching
            β”œβ”€β”€ inbox.js                  # Inbox management
            β”œβ”€β”€ messages.js               # Message display
            β”œβ”€β”€ canvas.js                 # Background animation
            β”œβ”€β”€ toast.js                  # Notification toasts
            └── ads.js                    # Ad slot loader

Email Routing Setup

After deploying, configure Cloudflare Email Routing to receive inbound mail.

1. Enable Email Routing

In the Cloudflare Dashboard:

  1. Go to Workers & Pages β†’ select your Worker β†’ Settings β†’ Triggers
  2. Under Domains & Routes, confirm your custom domain is listed
  3. Go to Email β†’ Email Routing on your domain
  4. Enable Email Routing (this creates the required MX and DNS records automatically)

2. Add Catch-All Route

  1. Go to Email β†’ Email Routing β†’ Routing rules
  2. Create a Catch-all address rule
  3. Set the destination to Send to a Worker β†’ select your Worker

3. SPF Record (recommended)

Add a TXT record to improve email deliverability:

Type Name Content
TXT @ v=spf1 include:_spf.mx.cloudflare.net ~all

Verify

Send an email to any address at your domain. If routing is working, the Worker's email() handler processes it and stores it in D1.


API Overview

jmail exposes a REST API at /api/ with 8 endpoints:

Method Endpoint Description
GET /api/config Public app config (branding, ads, theme)
GET /api/session Create or retrieve an anonymous session
GET /api/inboxes List inboxes linked to your session
POST /api/inboxes Create a new inbox (or claim an existing one)
DELETE /api/inboxes/:address Remove an inbox from your session
GET /api/inboxes/:address/messages Fetch messages for an inbox
GET /api/stats Public stats (total inboxes, messages, domains)
GET /api/health Health check

Full API documentation with curl examples: API.md


Tech Stack

Layer Tech
Runtime Cloudflare Workers
Router Hono
Email parsing PostalMime
Database Cloudflare D1 (SQLite)
Static hosting Cloudflare Workers Assets (edge CDN)
Language TypeScript
Frontend Vanilla HTML/CSS/JS

Commands

Command Description
npm run deploy Deploy Worker + static assets
npm run db:migrate Apply schema to production D1
npm run db:local Apply schema to local D1
npx wrangler dev Run Worker locally
npx wrangler tail Stream live logs

Documentation

Full documentation site: josskixg.github.io/jmail


License

MIT


Developed by masantoid

About

jmail β€” Free disposable temp mail on Cloudflare Workers. Anonymous inboxes, auto-sync, multi-domain, ads-ready, theme customizable. 🌸

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages