Postfix: allow unlisted sender only for a specific IP/Application

orsomannaro asked:

To avoid backscatter emails, on Postfix I set:

smtpd_reject_unlisted_sender = true

But this prevents the Odoo from sending some particular emails, since it uses some custom aliases as sender:

SMTPRecipientsRefused: {'[email protected]': (550, b'5.1.0 <[email protected]@mydomain.com>: Sender address rejected: @mydomain.com')}

How can I whitelist the Odoo server/app?

My answer:


Instead of making this a global directive, place reject_unlisted_sender in smtpd_sender_restrictions (it must appear after permit_mynetworks and permit_sasl_authenticated, if you used that).

Now you can add the sender’s IP address to mynetworks = to whitelist it and cause it to bypass this check.

An example from my live mail server:

smtpd_sender_restrictions =
        permit_sasl_authenticated,
        permit_mynetworks,
        reject_unlisted_sender,
        reject_unauthenticated_sender_login_mismatch,
        permit

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.