[Mimedefang] action_tempfail question -- greylist at filter_begin

Rick Mallett rmallett at ccs.carleton.ca
Wed Feb 4 17:36:08 EST 2004


On Wed, 4 Feb 2004, David F. Skoll wrote:

> On Wed, 4 Feb 2004, Xiaoyan Ma wrote:
>
> > Thanks again. Although I have not found a solution yet, I have learned more
> > about MD with everyone's help.
>
> This is pseudocode that shows how CanIt does it if you defer greylisting:
>
> sub filter_begin () {
>    my $recip;
>    my $tempfail = 0;
>
>    foreach $recip (@Recipients) {
>       if (should_greylist($Sender, $recip, $RelayAddr)) {
>          $tempfail = 1;
>          # Note:  We do NOT break out of the loop here!
>       }
>    }
>
>    if ($tempfail) {
> 	return action_tempfail("First-time sender tempfailed as anti-spam measure; please try again.");
>    }
> }
>
> As others wrote, it's important to check *all* the recipients each time,
> otherwise you end up greylisting many times over for a mail with lots of
> recipients.
>

Not necessarily. The other way of doing it is to just use
$Recipients[0] as the recipient as in

    if (should_greylist($Sender,$Recipients[0],$RelayAddr)) {
        return action_tempfail("Please try again later");
    }

This reduces the size of the greylist database and has the same effect
on the message in question, the downside being that the other recipients
don't get a free pass because of this delivery, but as David has pointed
out several times in the past the vast majority of messages have a single
recipient so who cares.

- rick adding an extra line to ensure I don't get hit by the quoting rule



More information about the MIMEDefang mailing list