Restricting outgoing mail to specific domains in From Address using Postfix
I can confirm that what you see in your postfix was intended behavior of
reject_unlisted_sender. This documentation page clearly states 4 conditions when postfix rejected your email
- The sender domain matches $mydestination, $inet_interfaces or $proxy_interfaces, but the sender is not listed in $local_recipient_maps, and $local_recipient_maps is not null.
- The sender domain matches $virtual_alias_domains but the sender is not listed in $virtual_alias_maps.
- The sender domain matches $virtual_mailbox_domains but the sender is not listed in $virtual_mailbox_maps, and $virtual_mailbox_maps is not null.
- The sender domain matches $relay_domains but the sender is not listed in $relay_recipient_maps, and $relay_recipient_maps is not null.
When the sender address doesn't match any condition above, by default postfix will permit it.
Back to your original question: The only way I've figured out how to do this so far is as follows. But is there anything simpler?
NO, your only options is likely SMTPD restiction classes. For other solution, you can use any policy server addon such as postfwd, policyd and others.