All Projects

2025

SMTPOP — SMTP/POP3 Email System over TCP

A from-scratch email system implementing simplified SMTP and POP3 protocols over raw TCP sockets, with a custom DNS server for mail server discovery and multi-domain support.

With Caleb Naeger

Python TCP Sockets SMTP POP3 DNS Email Protocols
SMTPOP — SMTP/POP3 Email System over TCP — image 1
SMTPOP — SMTP/POP3 Email System over TCP — image 2
SMTPOP — SMTP/POP3 Email System over TCP — image 3
SMTPOP — SMTP/POP3 Email System over TCP — image 4
SMTPOP — SMTP/POP3 Email System over TCP — image 5
SMTPOP — SMTP/POP3 Email System over TCP — image 6
SMTPOP — SMTP/POP3 Email System over TCP — image 7
SMTPOP — SMTP/POP3 Email System over TCP — image 8

Overview

SMTPOP is a ground-up implementation of an email delivery system — no libraries that abstract the protocols. It covers the full stack: DNS-based server discovery, SMTP for sending, POP3 for retrieval, and a client UI for composing and managing messages.

Components

DNS Server Maps domain names to IP/port pairs, enabling SMTP clients to discover mail servers the same way real DNS MX records work. Adding a new domain requires only a config entry.

SMTP Server Authenticates users, accepts incoming SMTP connections, stores messages in a per-user JSON database, and exposes them via POP3. Supports multi-domain routing — messages to user@class.com and user@email.com are handled through their respective servers.

POP3 Server Allows clients to retrieve and manage their mailboxes after authenticating.

Email Client Interactive terminal UI for composing and sending messages via SMTP, and retrieving inbox messages via POP3.

Key Design Details

  • Built on raw TCP sockets — every protocol command is hand-parsed
  • Base-64 encoding for credential exchange during authentication
  • JSON flat-file storage for per-user mailboxes (no database dependency)
  • Supports LAN-based cross-machine email delivery between different physical hosts
  • Preconfigured for two domains; extensible to more