1

I am trying to filter mail at the user level. I have CentOS and Postfix installed.

I managed to install a filter on the server and its working great, except, instead of filtering by user, all emails (sent and received) for all users are getting through the filter. (I want only emails sent to bounce@example.com to go through the filter).

I have added to master.cf:

myhook unix - n n - - pipe flags=F user=nils_filter argv=/path to/postfix.php ${sender} ${size} ${recipient}
smtp inet n - - - - smtpd -o content_filter=myhook:
pickup fifo n - - 60 1 pickup -o content_filter=myhook:

main.cf has:

smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/access,permit_mynetworks, reject_unauth_destination

and I updated the access file with:

bounce@example.com FILTER myhook

After running postmap and reloading, it is working for the entire example.com domain (all emails sent and received on smtp are getting piped through the filter I setup).

Could you point me in the right direction where I might be wrong?

Cristian Ciupitu
  • 6,226
  • 2
  • 41
  • 55
Nash
  • 11
  • 1
  • 2
    Just responding to the title of your question ; a `.forward` file per user or an entry in the aliases file which pipes mail to a script `| ./script` maybe? – HBruijn Jan 05 '15 at 22:44

1 Answers1

1

All emails got piped into because you specify content_filter on smtpd and pickup in master.cf.

Solution:

  • Remove the string -o content_filter=myhook: from master.cf
  • Put myhook in access file with proper syntax

    bounce@example.com FILTER myhook:
    

Reference: man access

masegaloeh
  • 17,978
  • 9
  • 56
  • 104