Postfix error “Sender address rejected”

postfix

My company is using Oempro to send out some emails to our clients. It looks like when we try to send emails to a large number of people, Oempro sets Mail From to be something like: bounce-[some number here]@mydomain.com. I believe that that number is based on the mailing list that we are sending our emails to. This allows Oempro to see which emails in which list are not valid.

The problem is that my postfix looks to verify that the sender actually has a mail account. I've checked some files and config but I am really confused. Is there someway to add a regular expression that tells postfix to allow things like bounce*@mydomain.com to go through? I looked at the /etc/postfix/access file but didn't really understand how to use it with regular expressions. Is this where I should be looking? Thanks!

Best Answer

From the Postfix documentation, it appears you need to modify this section in your main.cf file:

http://www.postfix.org/ADDRESS_VERIFICATION_README.html

/etc/postfix/main.cf:
    smtpd_sender_restrictions = 
        permit_mynetworks
        ... 
        check_sender_access hash:/etc/postfix/sender_access
        reject_unknown_sender_domain
        warn_if_reject reject_unverified_sender 
        ...
    # Postfix 2.6 and later.
    # unverified_sender_reject_reason = Address verification failed

    # Default setting for Postfix 2.7 and later.
    # Note 1: Be sure to read the "Caching" section below!
    # Note 2: Avoid hash files here. Use btree instead.
    address_verify_map = btree:/var/lib/postfix/verify

This will put warning messages in your logs when a sender fails verification, but it won't reject it. You can remove the warn_if_reject line if you don't want to pollute your log files.

UPDATE:

If you want regular expressions, you'll need to compile PCRE support into Postfix (if it's not there already):

http://www.postfix.org/PCRE_README.html

Then, you can simply replace the line check_sender_access hash:/etc/postfix/sender_access with: check_sender_access pcre:/etc/postfix/sender_access and it will check for regex's in that file. If you're using Debian/Ubuntu, there's a package called postfix-pcre that will install support for PCRE.

http://www.postfix.org/pcre_table.5.html