Last Updated: January 04, 2021
· borisguery

Quick and reliable testing SMTP server

python -m smtpd -n -c DebuggingServer -d localhost:25

(Optionally you may need to sudo)

It will start an SMTP server binded on localhost at port 25

Now, when a mail will be processed by your server, it will ouput something like:

Incoming connection from ('', 64841)
Peer: ('', 64841)
Data: 'MAIL FROM:<>'
===> MAIL FROM:<>
Data: 'RCPT TO:<>'
===> RCPT TO:<>
recips: ['']
Data: 'DATA'
Data: 'Email content'
---------- MESSAGE FOLLOWS ----------
Email content
------------ END MESSAGE ------------

If you are tired of the verbosity, you may want to remove the -d flag.

1 Response
Add your response

Debugging SMTP in debian console via Telnet is damn horrible. Thanks for this!

over 1 year ago ·