Last Updated: February 25, 2016
· 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:<alice@example.com>'
===> MAIL FROM:<alice@example.com>
sender: johndoe@example.com
Data: 'RCPT TO:<bob@example.com>'
===> RCPT TO:<bob@gmail.com>
recips: ['bob@gmail.com']
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.

Say Thanks

1 Response
Add your response

736212 10200976756252420 836055407 o

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

over 1 year ago ·