Setup a local testing SMTP server

I need to set up an SMTP server, really the goal is so that this server has no communication with the outside world, I would create the server, and would want a mail client looking at messages the server generates (brownie points if all messages go into the same inbox). This is basically to test out my mail system and see how it looks on different clients, while at the same time not actually sending emails to people.

Any advice, any known systems that do this?


Solution 1:

There are two solutions off the top of my head:

The first is to install postfix and accept the default configuration. Any mail sent to username@server (or just a username if it's all on one server) would be delivered to that specific user. It's fairly easy to get going and can be expanded to a full mail system in the future without much pain.

The second solution, which I leaned of in the Django documentation, is to run:

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

You may need to run this as root to claim the port. Any mail that is sent to your server will appear on the terminal as long as you have this running. It's great for testing out mail in different applications.