Need sugestions on how to implement/what to use/what or about what to read in order to know how, a mail server in Python, which would let me to generate temporary mailboxes.
Let’s say I have a domain test.com, I would like to be able to setup for example a mailbox [email protected], which would receive and store mails (even in txt files).
What do I need to be able to do that? (I’m interested in links or explanations rather than implementations)
Python 3 ships with the
smtpd
module that can be used to implement this.You'll probably want to trivially subclass
smtpd.SMTPServer
(maybe even derive from or at least be inspired bysmtpd.DebuggingServer
, but have it print out to files instead of standard output).Once that's up and running (you can use the
smtplib
clients to test things out), you'll need to have that server process running on a machine on port 25 (the standard SMTP port), and you'll need to point the MX record oftest.com
to that machine's address.