Marcin Rzepecki a écrit : > Hello again, > I've played a little with various combinations and I've found following > solution, > but it's pretty complicated, I think :) > > I'm launching filter through smtpd_recipient_restrictions: > smtpd_recipient_restrictions = > permit_sasl_authenticated > permit_mynetworks > [...] > check_recipient_access pcre:/usr/local/etc/postfix/filter_dspam > > To make it work as I wish I have to: > 1) provide virtual aliases to get correct destination user for dspam: > user.alias user1 > user.second.alias user1 > > 2) set a filter: > /user1/ REDIRECT us...@second-server > /./ FILTER lmtp:unix:/var/run/dspam/sock > > 3) Maintain local aliases too: > user.alias: user1 > user1: us...@second-server > > Now, when I'm getting mail for user.al...@first-server it's beeing > forwarded to us...@second-server without any filtering. Other mail is > filtered, local mail is bypassed too.
now try sending a message to user1 and user2, where user1 and user2 are configured differently, and you'll see that the message is either filtered (for both) or not filtered (for both). you can't use this method to filter mail fro user1 and skip the filter for user2. for any message, only one content_filter is used. > Is there really no way to fire up the filter only after knowing mail final > destination? > smtpd restrictions work on envelope information: sender and recipient are those specified by the remote client. >> if you want filtering per recipient, then you can do this in dspam >> (optin...). otherwise, you need multiple postfix instances (run postfix >> twice) in which case you can use transport_maps for filtering (instead >> of content_filter and FILTER). > > So I need one instance to forward some users to other server or > transport to dspam filter and the second for filtering and local > delivery? you need an instance that listens on port 25 (before the filter) and an instance that comes after the filter (port 10025 for example). so instead of setting up multiple smtpd listeners in master.cf, you would run postfix twice, each with its own config_directory, queue_directory and data_directory... etc. this will be easier in postfix 2.6. > I would like to avoid surplus solutions ;) > then do the selection in dspam instead. or pass all mail to dspam and ignore the results for some users.