For some reasons I happen to like a mail server configuration. Maybe it's just with Postfix, I didn't try anything else for ages. This is why the following task seemed interesting to me.
Let's say we have two sites: first a beta with latest features under testing and second is the production one. We don't want our e-mails to be sent on the beta except for some users who test the site. But we can't just remove other users because the good infrastructure is critical for the beta site (and it's fun to test with a recent copy of the production data). One good approach is to change the users' emails to point somewhere like firstname.lastname@example.org thus guaranteeing that those emails won't be delivered to the real person. But we can actually go further by telling Postfix to discard all messages for email@example.com without even trying to deliver them.
It's easy to do with header checks. So, here's a little snippet:
In /etc/postfix/main.cf: header_checks = pcre:/etc/postfix/header_checks In /etc/postfix/header_checks: /^To:.*@example.com/ DISCARD