See patch

-- 
Robin Hugh Johnson
E-Mail     : [EMAIL PROTECTED]
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85
This patch adds per-line rejection reasons support to check_badmailfrom, thus
allowing customized messages to rejected senders (Like telling AOL users to
complain to their ISP).

Signed-off-by: Robin H. Johnson <[EMAIL PROTECTED]>

--- check_badmailfrom.orig      2006-12-18 01:24:47.000000000 -0600
+++ check_badmailfrom   2006-12-18 01:30:04.000000000 -0600
@@ -1,7 +1,7 @@
 # -*- perl -*-
 =head1 NAME
 
-check_badmailfrom - checks the standard badmailfrom config
+check_badmailfrom - checks the badmailfrom config, with per-line reasons
 
 =head1 DESCRIPTION
 
@@ -13,6 +13,9 @@
 listed in badmailfrom.  A line in badmailfrom may be of the form
 @host, meaning every address at host."
 
+You may optionally include a message after the sender address (leave a space),
+which is used when rejecting the sender.
+
 =head1 NOTES
 
 According to the SMTP protocol, we can't reject until after the RCPT
@@ -33,11 +36,14 @@
   my $from = lc($sender->user) . '@' . $host;
 
   for my $bad (@badmailfrom) {
+    my $reason = $bad;
+    $reason =~ s/^\s*(\S+)[\t\s]+//;
+    $reason = "sorry, your envelope sender is in my badmailfrom list" unless 
$reason;
     $bad =~ s/^\s*(\S+).*/$1/;
     next unless $bad;
     $bad = lc $bad;
     $self->log(LOGWARN, "Bad badmailfrom config: No \@ sign in $bad") and next 
unless $bad =~ m/\@/;
-    $transaction->notes('badmailfrom', "sorry, your envelope sender is in my 
badmailfrom list")
+    $transaction->notes('badmailfrom', $reason)
       if ($bad eq $from) || (substr($bad,0,1) eq '@' && $bad eq "[EMAIL 
PROTECTED]");
   }
   return (DECLINED);

Attachment: pgpxAbqUgF10k.pgp
Description: PGP signature

Reply via email to