Mock SMTP is a SMTP server that does not deliver message, instead it save the messages to files in your file system.
This is a development tool, used to test email sending from apps.
# python mock-smtp.py
By default the server will listen on port 25, and bind to 127.0.0.1, plus e-mails will be saved to the current directory. This behaviour can be changed by using the following environment variables, respectively:
MOCK_SMTP_ADDRESS
MOCK_SMTP_PORT
MOCK_SMTP_PATH
Note: Mock SMTP must be run as root for binding to ports below 1024,
otherwise you will get a PermissionError exception. When run as root, the
daemon will drop privileges, and assume the same identify of the owner/group
of current directory or (the one specified in MOCK_SMTP_PATH
), after the
SMTP socket is open.
$ mkdir emails
$ docker run --rm -p 25:25 -v $(pwd)/emails:/var/lib/mock-smtp -d flaviovs/mock-smtp
$ telnet localhost 25
220 97e09283eb3f Python SMTP proxy version 0.2