> >> Jevos, Peter a écrit : > >>> Dear all > >>> > >>> I'd like to ask you a question. > >>> > >>> In my master.cf is: > >>> > >>> [snip] > >>> ##disclaimer > >>> disclaimer unix - n n - - pipe > >>> flags=Rq user=altermime argv=/etc/postfix/filter/disclaimer -f > >>> ${sender} -- ${recipient} > >>> > >>> > >>> It leads to error: Too many hops , in the log there is loop. > >> so your filter is passing mail back to an smtpd that passes it to > the > >> same filter, and so on. > >> > >> if your filter resubmits mail via the sendmail command and if you > don't > >> want to filter mail submitted via the sendmail command, then add > >> > >> -o content_filter= > >> > >> to the pickup service (in master.cf). > >> > >> > >> > >>> [snip] > >>> > >>> So the question is where can I put the content_filter=disclaimer: > to > >>> work only for outgoing emails , into which smtpd process? > >>> > >> you can use the FILTER statement in smtpd restrictions. > >> > > Thank you for your answer. When I added o content_filter= into the > pickup line it works. No more loops. > > > > But still I'm recieving the disclaimer also for incoming mail, which > is clear cause filter is located in the amavis filter: > > ... > > 127.0.0.1:10025 inet n - n - - smtpd > > -o content_filter=disclaimer: > > -o local_recipient_maps= > > > > .... > > > > So I have to take it away and put somewhere else. > > Can you please describe more FILTER statement or better put some > example for me ? > > > > smtpd_sender_restrictions = > check_client_access pcre:/etc/postfix/filter_outbound > permit_mynetworks > permit_sasl_authenticated > check_client_access pcre:/etc/postfix/filter_inbound > > == filter_outbound > # filter for outbound mail > /./ FILTER yourfilter:[127.0.0.1]:10587 > > = filter_inbound > # filter for inbound mail > /./ FILTER yourfilter:[127.0.0.1]:10030 > > > of course, you can't do this after amavisd-new, since at this time you > don't know if mail is inbound or outbound. > > you need to think your mail path carefully.
Thank you for your example, I already read FILTER_README and also Book of Postfix but I'm missing more examples. If I understood it correctly I have created: cat /etc/postfix/filter_outbound /./ FILTER altermime:[127.0.0.1]:10587 cat /etc/postfix/filter_inbound /./ FILTER smtp-amavis:[127.0.0.1]:10024 I have adjusted smtpd_sender_restrictions as you adviced and removed content_filter = smtp-amavis:[127.0.0.1]:10024 from main.cf Now I have in my master.cf: .... smtp-amavis unix - - n - 5 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes -o disable_dns_lookups=yes 127.0.0.1:10025 inet n - n - - smtpd -o content_filter= -o local_recipient_maps= -o relay_recipient_maps= ....... And where I can put the syntax for filter_outbound smtpd daemon in the master.cf? I know that postfix cannot distinguished inbound or outbound traffic , but I'm still using only one eth card. I've found some examples with 2 smtpd instances but i'm not sure if it's right solution for me. I just want to use altermime only for outgoing traffic Thank you BR PEter