I want to test a Newsletter application on a dummy server but I don't want all the clients in my DB (dumped from the live server) to get an email. Is there any way to prevent sendmail from sending those mails really out and instead save them to a file or something similar?
You can do something like this:
/etc/mail/users-to-test contains the usernames that we do not want them to receive email from the test server. This addition to Ruleset 2 discards all email directed to them, and it is assumed that the above ruleset is applied to the sendmail running in your test machine and not on the production server.
PS: tabs separate the left from the right hand side of the rules. tabs and not spaces, so do not copy-paste.
We do this using multiple sendmail instances (each listening on different virtual interface) on a dedicated SMTP server which also runs cyrus IMAP server. We have multiple instances because we'll have multiple sets of developers/testers trying out different things.
In the sendmail mc file ...
In the mailertable file (fields separated by tabs, order of lines important) ...
That example has messages for users at the mailtest.ncl.ac.uk domain being delivered normally with everything else delivered to paul's local mailbox. If you want all messages to be stored in a local mailbox then just a single line of the form
should do it.
If you have a Windows box around there is a simple single .EXE file your can run -- no install necessary.
Windows 7/Vista/XP/2003/2010 compatible dummy SMTP server. Sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected. Useful for testing/debugging software that generates email.
We use it for on our development systems and it works great.