Here is example of my header_checks filtering by pcre regular expression table. That will help us to avoid accidental e-mail delivering to real customer from qa/dev/stage environment. As you can see below all e-mails will be rejected except those that we already whitlisted. In our case [email protected] will be whitlisted and we can use this e-mail in test purpose. Another regular expression little bit complacated and all e-mail that will match this pattern: pass.qa.test.email[DIGITS]@[domain].[zone] will be delivered.
header_checks = pcre:/etc/postfix/header_checks.pcre
/^To: firstname.lastname@example.org/ OK
/^To: paas.qa.test.emaild+@(?:[w-]+.)+w+/ OK
/^To: / REJECT