Use this file to discover all available pages before exploring further.
Zapmail is built with a custom SMTP server in Go and a Next.js frontend, using PostgreSQL for email storage. This architecture enables a lightweight, efficient temporary email service.
Server action queries the database for matching recipient addresses
Raw email data is parsed using the mailparser library
Parsed emails are returned and displayed in the UI
// From ui/src/app/actions/actions.ts:14-20const result = await db.query( `SELECT id, username as mail_from, recipient as rcpt_to, raw_data as data, received_at as date FROM emails WHERE recipient = $1 ORDER BY received_at DESC`, [formattedQuery]);
The SMTP server initializes with the following steps:
// From backend/main.go:35-61func main() { db := connectDB() // Start the cleanup job to purge emails older than 7 days. go startCleanupJob(db) port := os.Getenv("PORT") if port == "" { log.Fatal("PORT environment variable not set") } // Start listening for incoming SMTP ln, err := net.Listen("tcp", ":"+port) if err != nil { log.Fatal("Error starting server:", err) } log.Println("Temporary Mail Service SMTP Server listening on port "+port) // Accept connections in an infinite loop for { conn, err := ln.Accept() if err != nil { log.Println("Error accepting connection:", err) continue } go handleConnection(conn, db) }}
The server uses goroutines to handle multiple SMTP connections concurrently, allowing it to process many emails simultaneously.