I like to use the module smtpd out of Python's standard library when working on code which wants to send out email. It allows to run an SMTP server which just dumps out everything on stdout with nearly no efforts.

Running the server

Bringing up the SMTP server is as simple as running the following command:

python3 -m smtpd -c DebuggingServer -n localhost:1025

This will bring up a simple SMTP server which listens on port 1025 on the loopback device.

Using the server

Just adjust the configuration file or environment variables depending on your project, e.g.:

smtp_server = localhost
smtp_port = 1025

Do not use things like SSL, TLS or a username and password, they are not needed to speak to your debugging server.


Comments

comments powered by Disqus