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

Preferably this could be done with a virtual instance of a mail server on an existing Linux machine but I'm willing to run a whole other install (Linux or Windows) to get this to work.

Basically a system we use generates emails to customers when we do certain things. On the testing setup, we regularly import a full live snapshot to test reports etc. The problem is that this can end up with us sending incorrect emails to our customers.

My goal is the specific a different mail server on the server which would accept all mail, then redirect it back to the dev team. Best I can come up with is creating catchall address forwards for every domain of every customers. There must be a better option though?

Machine will not be internet facing so spam is not a risk on this.

Edit: There a multiple customer address domains. Any catchall solution would need to not be domain specific. The from field also varies depending on the user logged in or section of the system. We also need to see the emails which is why they are being redirected.

share|improve this question
up vote 1 down vote accepted

As towo pointed out, address rewriting is one way. Exim also has a nice framework for this:

BTW, what you want is often referred to as a "catchall" address. That might help in googling a config for your chosen mailserver.

You might also consider modifying your test system to dump mail to a file instead of sending it. That avoids the hassle of having a special "test" mailserver which does the catchall thing; also you could easily parse the file automatically to decide whether the test succeeded. Of course, might not be an option to change the system under test...

share|improve this answer
Catchall addresses are a bad idea. It won't be long before your domain is flooded with spam messages, since to the spammers every email they try will appear to be valid. – Kamil Kisiel Jul 21 '09 at 6:32
@Kamil: In principle you're right. But read the question: "Machine with not be internet facing so spam is not a risk on this.". – sleske Jul 21 '09 at 10:49

Most mail servers support rewriting addresses or changing delivery method base on some metric over the input mail. You could either rewrite all outgoing addresses with a local user, or just change the delivery method to dump it unceremoniously into a file.

If you're using postfix, for example, there's a rather thorough documentation available, even though it does not specifically list your case.

share|improve this answer
The rewriting all comes in from of from -> to. I've yet to see it handle a * -> to although I don't it can do *@domain -> to. All these addresses a fully valid addresses that I need changed. – Ryaner Jul 8 '09 at 12:00

As a thought, your test setup of your app will have a different IP then the production one correct?

Could you setup your existing mail server so that all email from IP xyz get redirected to user abc?

This lets you keep your test app exactly the same with only mail server changes now.

share|improve this answer
Any idea what this would be called? – Ryaner Jul 8 '09 at 13:32

I would assume those emails are being sent from the one account. Is it practical to temporarily have your mail server refuse mail from that account for the duration of the tests?

share|improve this answer

I'd suggest using sieve for your needs, since it's not tied to a particular MTA. We use it extensively to filter/block for ourselves and our customers.

share|improve this answer

I'm looking for something similar to use as an SMTP server in a test environment. So far I've found subethasmtp, Devnull SMTP server and Dumbster, but I haven't had opportunity to test any of them yet.

Ideally I'd like something with a web interface to review and manage the emails it received.

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.