A temporary email service that lets you receive emails at disposable addresses. Built with a Rust backend (Axum + SQLite) and a Next.js frontend.
Internet
│
├── Port 25/2525 (SMTP) → Rust SMTP Receiver → SQLite
│
└── Port 3001 (HTTP) → Axum API Server
│
├─ REST /api/*
└─ SSE /sse/inbox/:address
│
Next.js Frontend (Port 3000)
magic-mail/
├── server/ # Rust backend (Axum + SMTP)
│ ├── src/
│ │ ├── main.rs # Entry point
│ │ ├── api/ # REST + SSE endpoints
│ │ ├── smtp/ # SMTP receiver
│ │ ├── db/ # SQLite queries
│ │ ├── models.rs # Data types
│ │ ├── notify.rs # SSE broadcast channel
│ │ └── tasks/ # Background cleanup
│ └── Cargo.toml
│
└── magic-client/ # Next.js frontend
└── src/
├── app/ # Pages + layout
├── components/ # AddressBar, InboxList, EmailViewer
├── hooks/ # useInbox (SSE + polling)
└── lib/ # API client
- Rust 1.75+
- Node.js 20+
- npm (or bun)
cd server
cargo runThe backend starts on:
- HTTP API:
http://localhost:3001 - SMTP:
localhost:2525
cd magic-client
npm install
npm run devThe frontend starts on http://localhost:3000 and auto-proxies /api/* and /sse/* to the backend.
Open http://localhost:3000 in your browser. A temporary email address is generated automatically on first visit. Send a test email:
Send-MailMessage -From "test@example.com" `
-To "YOUR_GENERATED_ADDRESS" `
-Subject "Hello" `
-Body "Testing the temp mail service" `
-SmtpServer "127.0.0.1" `
-Port 2525The email appears in the inbox in real-time via SSE.
| Method | Path | Description |
|---|---|---|
GET |
/api/health |
Health check |
GET |
/api/domains |
List allowed domains |
POST |
/api/address/generate |
Create a temp address |
GET |
/api/emails/:address |
List emails for an address |
GET |
/api/emails/:address/:id |
Get a single email |
DELETE |
/api/emails/:address/:id |
Delete one email |
DELETE |
/api/emails/:address |
Clear all emails |
GET |
/sse/inbox/:address |
SSE stream for real-time updates |
Edit server/src/main.rs to set allowed domains and ports:
let allowed_domains = vec!["realblue.lol".to_string()];- SMTP port: defaults to
2525(change insmtp/mod.rs) - HTTP port: defaults to
3001(change inapi/mod.rs) - Email TTL: defaults to
10minutes (change inapi/address.rs)
For production deployment on a VPS (e.g., Oracle Cloud):
- Change SMTP port to
25insmtp/mod.rs(requires root) - Point MX record to your server IP
- Open port 25 in your firewall / security list
- Build the backend:
cd server && cargo build --release - Build the frontend:
cd magic-client && npm run build - Use
npm run startorpm2/systemdto run
- Backend: Rust, Axum, SQLite (sqlx), tokio
- Frontend: Next.js, React, TypeScript, Tailwind CSS
- Real-time: Server-Sent Events (SSE)