Python – Email Server

Python – Email Server

If you’re developing an email feature, you can use python smtp debugging mail server for local testing purpose. It can save you time.

Mail Server

Run the following command

python -m smtpd -n -c DebuggingServer localhost:8025


Set Environment Variable

export MAIL_SERVER=localhost
export MAIL_PORT=8025



Output will be capture and can be view in terminal

---------- MESSAGE FOLLOWS ----------
b'From: [email protected]'
b'To: [email protected]'
b'Subject: My System Failure'
b'Date: Thu, 01 Feb 2018 19:03:57 +0800'
b'Content-Type: text/plain; charset="utf-8"'
b'Content-Transfer-Encoding: 7bit'
b'MIME-Version: 1.0'
b'X-Peer: ::1'
------------ END MESSAGE ------------


Write a Reply or Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.