Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

You can do something like this:

# File that contains recipients usernames that interest us in this test
F{Users} -o /etc/mail/users-to-test
# File that contains recipients domains that interest us in this test
F{Domains} -o /etc/mail/domains-to-test

R $={Users} < @ $={Domains} . >      $#discard $: discard

/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.

share|improve this answer

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 ...

FEATURE(`mailertable', `hash -o /etc/mail/mroute2-mailertable.db')dnl

In the mailertable file (fields separated by tabs, order of lines important) ...
.         local:paul

That example has messages for users at the 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

.    local:paul

should do it.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.