3

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?

1
  • Update: Running CentOS. Aug 29, 2012 at 3:29

2 Answers 2

3

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.

1
  • That was my first inclination, and I may ultimately end up doing just this. Aug 29, 2012 at 3:29
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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