In this case, we merely main::delete_recipient($recipient_A); then main::action_accept() for the rest of the recipients.
You cant tempfail individual recipients once you peek at the message and see that it is spam. By the time you see the message, you've already accepted the recipients. Different mimedefang-milter processes might handle the same message. One milter process could handle the relay while a different one handles the sender. In fact, different processes could handle different recipients of the same message. This makes persistent variables like $rcpt_count difficult to implement. Dale Moore Carnegie Mellon University -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Benoit Panizzon Sent: Tuesday, April 16, 2013 5:52 AM To: [email protected] Subject: [Mimedefang] How to count recipients in filter_recipient Hello The situation: Recipients have different SpamAssassin Settings: Recipeint A => "NO FILTERING"; Recipient B => "REJECT SPAM"; Now an email arrives mail from:<sender> rcpt to:<Recipient A> rcpt to:<Recipient B> Now if this is an email that will be handled as spam, we have the problem, that Recipeint A does want to receive that email and Recipient B want us to reject it during SMTP Handshake. We could: Accept the Email and deliver it only to Recipient A. Problem: If it was a false positive, that sender does not know it was not delivered to Recipient B. His Maillog will tell him it was successfully delivered. => NoGo. We could: Reject that email: Recipient A will complain that we filtered the email even though his settings tell us not to do so. = NoGo. Solution: We only accept those recipients which have identical anti-spam settings and tempfail the others, forcing the sending MTA to resent them in a separate session. So we can then handle that session according the users settings. sub filter_sender { $rcpt_count = 0; return ('CONTINUE',"ok"); } sub filter_recipient { if ($rcpt_count eq 0) { my $filterrule = &getspamsettings($recipient); } else { $rcpt_count++; return ('TEMPFAIL', "Too many Recipients") if ($rcpt_count > 50); return ('TEMPFAIL', "Different Spam Setting, please resend separately") if ($filterrule != &getspamsettings($recipient)); } return ('CONTINUE',"ok"); } Well, this is the basic idea. Please ignore the syntax errors :-), I just started with the $rcpt_count in my code. Unfortunately filter_sender and filter_recipient calls are carried to different filter processes. So the counter is not reset. Is there a way to define some sort of over-global variable that is consistent for one SMTP session between all of the mimedefang processes? Kind regards Benoit Panizzon -- I m p r o W a r e A G - ______________________________________________________ Zurlindenstrasse 29 Tel +41 61 826 93 07 CH-4133 Pratteln Fax +41 61 826 93 02 Schweiz Web http://www.imp.ch ______________________________________________________ _______________________________________________ NOTE: If there is a disclaimer or other legal boilerplate in the above message, it is NULL AND VOID. You may ignore it. Visit http://www.mimedefang.org and http://www.roaringpenguin.com MIMEDefang mailing list [email protected] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang _______________________________________________ NOTE: If there is a disclaimer or other legal boilerplate in the above message, it is NULL AND VOID. You may ignore it. Visit http://www.mimedefang.org and http://www.roaringpenguin.com MIMEDefang mailing list [email protected] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

