[Exim] Block all outgoing mails except for specific domains

The common practice on preproduction environment, is to block all outgoing mails except for a given whitelist domain. To do that in exim you must modify the router section.

Edit your exim4.conf.template just after the “begin routers” line, add the following snippet:

catch_otherdomains:
        driver = redirect
        domains = !foobar.com:!example.fr
        data = :blackhole: