I was wondering if anyone knows of a way to ideally intercept (if not block) mailx from sending emails?

The situation is that we have a development server (CentOS) that hosts the current version of our website. The system as part of its processes sends out confirmation emails and the like which I'd like to ensure never see the light of day.

Ideally we'd like to be able to route these to a specific mailbox such that we could interrogate the emails being sent out.

If that's not possible simply blocking them would be a good starting point.

What is the most encompassing way to ensure this and are there any pitfalls to be wary of?



If you use Postfix as an MTA (which I guess is a default in CentOS) this can be easily done with transport_maps, just add these lines to /etc/postfix/main.cf:

transport_maps = hash:/etc/postfix/transport
luser_relay = your.local.user@your.local.domain

and create /etc/postfix/transport with the following content:

localhost :
your.local.domain :
* local:your.local.user

You should execute postmap /etc/postfix/transport then to make a hash representation of your transport map and restart Postfix. The local user your.local.user will get all outgoing emails then.

  • That looks like a great solution, I'll give it ago and let you know how I get on. – Rob Forrest Aug 21 '12 at 13:00

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.