Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

3 Answers

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/main.cf just to get email working at all. i.e.: relayhost = somerelay.isp.net

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

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

  4. Run: postmap /etc/postfix/transport

  5. Edit /etc/postfix/master.cf to include: test unix - n n - - pipe user=nobody argv=/bin/mail -s Signup me@realserver.com

  6. service postfix reload

Now signups using an email address of 1@example.com will result in an email being sent to me@realserver.com. 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.

Cheers

share|improve this answer
add comment

have you checked

always_bcc

option in main.cf ?

share|improve this answer
add comment

Your Answer

 
discard

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.