my postfix currently rejects emails that are potentially SPAM. Howver, some of my contacts have servers that are not correctly configured and I want to avoid rejecting their email.

smtpd_recipient_restrictions =
    check_recipient_access proxy:pgsql:/etc/postfix/pgsql/virtual_access_list.cf
    #check_sender_access proxy:pgsql:/etc/postfix/pgsql/virtual_sender_list.cf
    permit_dnswl_client list.dnswl.org
    reject_rbl_client zen.spamhaus.org
    reject_rbl_client blackholes.easynet.nl
    reject_rbl_client bl.spamcop.net
    reject_rbl_client cbl.abuseat.org
    reject_rbl_client ix.dnsbl.manitu.net
    reject_rbl_client b.barracudacentral.org
    reject_rbl_client psbl.surriel.com
    reject_rbl_client noptr.spamrats.com
    reject_rbl_client dyna.spamrats.com
    reject_rbl_client dnsbl.sorbs.net

However, I would like to automatically whitelist all senders that are in my Horde address book. This is why I try to include the line

check_sender_access proxy:pgsql:/etc/postfix/pgsql/virtual_sender_list.cf

With the following syntax

user = horde
password = xxxx
hosts = xxx
dbname = horde
query = SELECT ??? FROM turba_objects WHERE object_email='%s'

However, I am not sure about the logic:

  1. How do I set an value of "OK" to all entries that are found in the address book? What is the correct syntax?

  2. Does this approach work? Does it achieve the target of automatically accepting emails from all senders in my address book even when they are flagged as SPAM in one of these lists or are malformated? What is best practice?

  • Kindly let us know output required so that we can help in better way – Praveen Kumar BS Feb 3 at 10:08
  • The smtpd_recipient_restrictions list is an ordered list. If you are trying to allow emails from a poorly configured server, you will need to place your whitelist before the checks for poorly configured servers... for example, directly after your two permit_ lines.... I haven't checked your syntax for your query. – RubberStamp Feb 3 at 13:46
  • Reference links for postfix check_sender_access ... and... postfix access tables in DB – RubberStamp Feb 3 at 16:53

Tried with below command

sed -r '/\s+#/s/.*/&\nuser = horde\npassword = xxxx\ndbname = horde\nquery = SELECT ??? FROM turba_objects WHERE object_email='%s'/g' filename| sed -r 's/\s+#//g'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.