A premium, privacy-focused disposable email service built with Next.js and MongoDB. Features real-time inbox updates, custom domain support, and configurable privacy settings.
- 🛡️ Privacy First: Emails are stored in short-lived MongoDB records with auto-expiry logic.
- ⚙️ Configurable Retention: Users can set email lifespan from 30 minutes to 1 week.
- 🌐 Custom Domains: Bring your own domain via Cloudflare or Mailgun (Manage Domains GUI included).
- ⚡ Real-time: Instant email delivery and inbox updates.
- 🎨 Premium UI: Glassmorphism aesthetic, Dark Mode, and responsive mobile design.
- 📜 History: Locally stored history of generated addresses for quick access.
- 🔗 Pretty URLs: Shareable links like
https://app.com/user@domain.com.
- Incoming Mail: DNS MX Records point to your email routing service (Cloudflare/Mailgun).
- Webhook: The service forwards the raw email to
https://your-app.com/api/webhook. - Processing: The app parses the email, checks user retention settings, and stores it in MongoDB.
- Frontend: The Next.js UI polls the API to display emails for the current address.
Clone this repository and deploy it to Vercel.
Provision a MongoDB database (MongoDB Atlas or self-hosted) and set the connection string in Vercel:
MONGODB_URIMONGODB_DB(optional, defaults tovaultmail)
You need a service to receive SMTP traffic and forward it to your app's webhook.
We include a pre-configured worker in the worker/ directory.
-
Setup Cloudflare:
- Add your domain to Cloudflare.
- Enable Email Routing in the Cloudflare Dashboard.
-
Deploy the Worker:
cd worker npm install # Configure worker environment variables in Cloudflare (or via wrangler) # Required: # WEBHOOK_URL=https://your-vercel-app.vercel.app/api/webhook # Optional (forward specific domains to a verified Email Routing address): # FORWARD_DOMAINS=example.com,anotherdomain.com # FORWARD_EMAIL=verified@yourdomain.com npm run deploy
-
Route Emails:
- In Cloudflare Email Routing > Routes.
- Create a "Catch-All" route.
- Action:
Send to Worker-> Destination:dispomail-forwarder(or whatever you named it).
-
Optional: GitHub Actions Deploy:
- Set repository secrets:
CLOUDFLARE_API_TOKENCLOUDFLARE_ACCOUNT_IDWEBHOOK_URL(required)FORWARD_DOMAINS(optional)FORWARD_EMAIL(optional)
- Pushing changes under
worker/will trigger.github/workflows/worker-deploy.yml. - The workflow syncs the listed secrets on deploy so values stay consistent across redeploys.
- Set repository secrets:
-
Install Dependencies:
npm install
-
Environment Setup: Create
.env.localand add your MongoDB credentials:MONGODB_URI="your-connection-string" MONGODB_DB="vaultmail" # Optional: enable Google AdSense auto ads NEXT_PUBLIC_ADSENSE_CLIENT_ID="ca-pub-xxxxxxxxxxxxxxxx"
-
Run Development Server:
npm run dev
Ambil daftar email untuk alamat sementara.
Endpoint
GET /api/inbox?address=nama@domain.com
Response
{
"emails": [
{
"id": "uuid",
"from": "sender@example.com",
"to": "nama@domain.com",
"subject": "Hello",
"text": "Plain text",
"html": "<p>Plain text</p>",
"attachments": [],
"receivedAt": "2025-01-01T00:00:00.000Z",
"read": false
}
]
}Email routing service (Cloudflare/Mailgun) mengirim email ke endpoint ini.
Endpoint
POST /api/webhook
JSON Body Example
{
"from": "sender@example.com",
"to": "nama@domain.com",
"subject": "Hello",
"text": "Plain text message",
"html": "<p>Plain text message</p>",
"attachments": []
}Response
{ "success": true, "id": "uuid" }Endpoint
GET /api/download?address=nama@domain.com&emailId=uuid&type=email
GET /api/download?address=nama@domain.com&emailId=uuid&type=attachment&index=0
Endpoint
GET /api/retention
Response
{
"seconds": 86400,
"updatedAt": "2025-01-01T00:00:00.000Z"
}MIT License. Feel free to fork and deploy your own private email shield.
