You probably want to put the code in filter_recipient rather than filter_begin. I believe the SMTP conversation goes
HELO ... RCPT TO: ... (response - 2xx [OK] or 4xx [tempfail] or 5xx [permfail]) RCPT CC: ... (response - 2xx [OK] or 4xx [tempfail] or 5xx [permfail]) RCPT TO: ... (response - 2xx [OK] or 4xx [tempfail] or 5xx [permfail]) You probably need to tempfail each recipient at the time of the RCPT command, rather than gathering all the recipients as you do below. In other words, SMTP does not allow a RCPT TO: [EMAIL PROTECTED] RCPT CC: [EMAIL PROTECTED] RCPT TO: [EMAIL PROTECTED] 2xx [EMAIL PROTECTED] OK 4xx [EMAIL PROTECTED] tempfailed anti-spam try again 5xx [EMAIL PROTECTED] no such user > -----Original Message----- > From: Xiaoyan Ma [mailto:[EMAIL PROTECTED] > Sent: Monday, February 02, 2004 3:53 PM > To: [EMAIL PROTECTED] > Subject: [Mimedefang] action_tempfail and delete_recipient question > > > Have been running MD using example filter for awhile. First > time trying to > add some code. I would like to move David's greylist code from > filter_recipient to filter_begin. Searched list archive, > read and reread > man page. This is what I came up with: > > sub filter_begin () { > my $sender = canonicalize_email ($Sender); > my $ip = $RelayAddr; > > foreach $recip (@Recipients) { > if (should_greylist($sender, $recip)) { > md_syslog('warning', "Filter Recipient:$sender:$recip"); > #delete_recipient($recip); > return action_tempfail("Tempfailed as anti-spam > measure. Please try again."); > delete_recipient($recip); > } > } > > ..... > > > It works when there is one recipient and broke when there are more -- > tempfailed all recipients. I have 2 questions: > > 1. Does action_tempfail affects all recipients? > > 2. Is delete_recipient needed? If not, wouldn't tempfailed recipient > receive a copy of the message? > > or maybe my logic does not flow at all ? > > Thanks. > Xiaoyan > > _______________________________________________ > Visit http://www.mimedefang.org and http://www.canit.ca > MIMEDefang mailing list > [EMAIL PROTECTED] > http://lists.roaringpenguin.com/mailman/listinfo/mimedefang > _______________________________________________ Visit http://www.mimedefang.org and http://www.canit.ca MIMEDefang mailing list [EMAIL PROTECTED] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

