Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

We have a need at my work to setup a test email server that will take all mail sent to it for delivery and instead just dump it into an account for later retrieval. I've been out of the email server configuration game long enough that I think that's possible but I don't know for sure.

As a more specific example of what we need: We have code that sends emails to outside clients in certain cases. We want to point our code to a test server that will accept those emails, but not let them get to the outside world (yes, it's happened before, oops). We then need to be able to verify that Email X would have gotten sent to Client Y if we had sent to the real server.

As a bonus, we have a error email alias on our real server that goes to the programmers that we would like to keep getting email from. So anything sent to that alias on the test server would forward to our real server for delivery.

My preference is for postfix but our IT staff seems set on using sendmail (or Exchange) for everything so hints/pointers for either server would be helpful. Thanks a lot.

share|improve this question
up vote 2 down vote accepted

I think what you want is a mailsink.

You might need to alter somewhat for your specific requirements but I have used something like this to catch user verifications emails.

This procedure uses Postfix and assumes a Redhat-based distro.

  1. If on a local development box, you may need to edit /etc/postfix/ just to get email working at all. i.e.: relayhost =

  2. Edit /etc/postfix/ to include: transport_maps = hash:/etc/postfix/transport

  3. Create or edit /etc/postfix/transport and include: test:

  4. Run: postmap /etc/postfix/transport

  5. Edit /etc/postfix/ to include: test unix - n n - - pipe user=nobody argv=/bin/mail -s Signup

  6. service postfix reload

Now signups using an email address of will result in an email being sent to From there one can click on the user verification link or inspect the email for content, etc.

So you could add another transport for your outside client emails and send to a local server and use like above to send errors to real server.

Hope this helps.


share|improve this answer

have you checked


option in ?

share|improve this answer

I use this to fake the email sending:

Mailtrap is a fake SMTP server for development teams to test, view and share emails sent from the development and staging environments without spamming real customers.

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.