How ankraft/smtpproxy works
Project type and purpose
• This is a single‐service SMTP Proxy Server written in Python (a network daemon).
• Purpose: accept SMTP connections from clients, queue messages locally, optionally perform POP-before-SMTP authentication, invoke extensible handlers, then relay mail to one or more remote SMTP servers.
File structure
Top-level files & directories:
• smtpproxy.py – main entry point (starts listener, worker threads)
• smtps.py – underlying threaded SMTP server implementation (imported/extended)
• config.py – loads/parses smtpproxy.ini configuration
• MailHandler.py – abstract base class for mail handlers
• handlers/ – plug-in modules (each implements a MailHandler subclass)
• mlogging.py – central logging facility
• smtpproxy.ini.example / ini.d / service.example – configuration & service scripts
• msgs/ (created at runtime) – local mail queue (filesystem storage)
Architectural patterns & choices:
• Thread-per-connection for inbound SMTP (inherited from smtps.py)
• Producer/consumer model: listener threads produce saved message files; a relay thread consumes and forwards them.
• Plugin pattern: handlers loaded dynamically from handlers/ directory.
• Configuration-driven behavior (ini file)
• Logging via a rotating‐file logger
README for additional insights
• Confirms multi-threaded handling, POP-before-SMTP support, message queue directory, handler extension points, service installation.