A dummy SMTP server using python can be easily started with the following command.
python -m smtpd -n -c DebuggingServer localhost:8025
However, when I tried to send an email to this server by mailx, it was awkward, so I will write the procedure instead of a memorandum. Because mailx sends mail to MTAs such as sendmail or postfix It is good to specify the above dummy SMTP server as the relay server of sendmail or postfix. Since postfix was working in my environment The following settings have been added to /etc/postfix/main.cf.
relayhost = [127.0.0.1]:8025
Then restart postfix.
sudo systemctl restart postfix.service
Send with this
echo "test" | mail -v -s "test" [email protected]
The mail should arrive at the dummy SMTP server.
If you send an email to localhost, it depends on the settings. Because it just goes into my mailbox It does not reach the dummy SMTP server. be careful.
I am trying it in the CentOS 7 environment.
Recommended Posts