Simple SMTP relay with whitelist

smtpwhitelist

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?

Best Answer

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.

Related Topic