I have a staging server running Postfix, which I want to only set up to deliver mail to example.org. If we are testing a function that sends e-mail, we want to be able to know that we won't accidentally send any test messages out to anyone outside our test domain.
All mail is sent from this server to a smarthost for delivery.
I have set up
relay_domains = example.org
smtpd_recipient_restrictions = reject_unauth_destination
This means the server only relays for example.org by SMTP. However, using mail(1) on the server, it will deliver for all addresses. How can I restrict this to the relay_domains only?
None other than esteemed Postfix author Wietse Venema gives us the answer: