[Mimedefang] Filter by sender/recipient

David F. Skoll dfs at roaringpenguin.com
Thu Oct 14 10:05:48 EDT 2004


On Thu, 14 Oct 2004, Jim McCullars wrote:

> sub filter_recipient {
>   my ($recipient, $sender, $ip, $hostname, $first, $helo,
>         $rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;

>   if($recipient =~ /<?postmaster\@/i) {
>     return('ACCEPT_AND_NO_MORE_FILTERING', "ok")
>   }
>   return ('CONTINUE', "ok");
> }

That works perfectly.

But you'd better hope that spammers and virus-writers don't discover
that you're doing it, because then they can inject spam to anyone at all
as long as they include postmaster in the list of recipients.

I would rather do this:  In filter_begin, filter, filter_multipart
and filter end:

	if ($#Recipients == 0 && $Recipients[0] =~ /<?postmaster\@/i) {
	    # Skip processing
	    return;
	}

It involves more overhead than Jim's solution (because the message is still
parsed into MIME parts), but is a bit safer.

Regards,

David.



More information about the MIMEDefang mailing list