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.

I've got a test instance of a compiled web app (that I didn't write) which I'd like to do some testing with, however the app contains client email addresses that I would like to not receive emails while I do said testing.

Right now, this web app uses a particular SMTP server — call it mail1 — to send out notification emails when various events happen. To minimize the amount of customization I would need to do to the app or its data (which may skew the testing), I'm thinking a solution to avoiding sending these emails might be to stand up a temporary SMTP relay mail2 that inspects the outbound email addresses and only relays emails to mail if the emails are destined for a particular domain. All others not destined for that domain can be dropped, or even better, forwarded to a different address on that whitelisted domain to see that they would have been sent to clients if not for the whitelisting in mail2.

Is this the sort of thing I could do with Postfix or Qmail? If so, are there any recommendations for how to get started doing this? I've never configured either before, and I'm wondering if there's perhaps an entirely different mail-limiting solution that I'm overlooking. Maybe even something Gmail/Google Apps can do?

share|improve this question
    
Update: Running CentOS. –  Collin Allen Aug 29 '12 at 3:29
add comment

2 Answers

Depends on your setup and the underlying distro (I suppose that you use Linux). Personally, I would suggest to use tools of your distro. So, if your distro uses Postfix, use Postfix. If it uses Sendmail, use Sendmail.

I would recommend Postfix anyway, because it is extremely easy to setup a simple SMTP Gateway.

share|improve this answer
    
That was my first inclination, and I may ultimately end up doing just this. –  Collin Allen Aug 29 '12 at 3:29
add comment
up vote 1 down vote accepted

Ended up doing this with Postfix. The key portion of the main.cf file is:

relayhost = [mail1.mydomain.com]
smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/rcpt_whitelist, reject

And rcpt_whitelist contains:

whitelisted1.com OK
whitelisted2.com OK

Then I did postmap hash:rcpt_whitelist to load it.

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.