diff -ur qmail-scanner-1.23.org/configure qmail-scanner-1.23/configure
--- qmail-scanner-1.23.org/configure	2004-08-04 09:24:35.000000000 +0900
+++ qmail-scanner-1.23/configure	2004-08-20 10:35:12.000000000 +0900
@@ -158,7 +158,7 @@
 				     Set to "no" if you want them to be scanned
 				     anyway.
 
-  --notify "none|sender|recips|precips|admin|nmladm|nmlvadm|all" Defaults to "$NOTIFY_ADDRESSES". 
+  --notify "none|sender|psender|lsndr|phsndr|recips|precips|admin|nmladm|nmlvadm|all" Defaults to "$NOTIFY_ADDRESSES". 
 				     Comma-separated list (no spaces!)
 				     of addresses to which alerts should
 				     be sent to. "nmladm" means only
@@ -175,6 +175,13 @@
 				     if their e-mail was blocked for policy reasons. i.e. if an AV system 
 				     found a virus, then don't notify the sender/recip as the address was 
 				     probably forged.
+				     ================ Modified by lsender patch ====================
+				     Two NEW notify options are available - lsndr and phsndr.
+				     If "lsndr" is spcified, Q-S will notify sender ONLY if he belongs
+				     to local-domains. "phsndr" is the same but sender will notified
+				     if also mail was blocked by policy. In both cases, automated mail
+				     (ie. mailing-list) will avoid notification.
+
   --local-domains "one.domain,two.domain" Defaults to the 
 				     value of the "--domain" setting.
 				     Comma-separated list (no spaces!) 
@@ -429,7 +436,7 @@
 if [ "$NOTIFY_ADDRESSES" ]; then
      for addr in `echo $NOTIFY_ADDRESSES|sed 's/,/ /g'`
      do
-	if [ "`echo $addr|egrep -v '^(admin|nmladm|nmlvadm|none|sender|psender|recips|precips|all)$'`" != "" ]; then
+	if [ "`echo $addr|egrep -v '^(admin|nmladm|nmlvadm|none|sender|psender|lsndr|phsndr|recips|precips|all)$'`" != "" ]; then
 	    cat<<EOF
 
 
@@ -445,6 +452,8 @@
 nmlvadm
 sender
 psender
+lsndr
+phsndr
 recips
 precips
 all
diff -ur qmail-scanner-1.23.org/qmail-scanner-queue.template qmail-scanner-1.23/qmail-scanner-queue.template
--- qmail-scanner-1.23.org/qmail-scanner-queue.template	2004-08-03 11:26:19.000000000 +0900
+++ qmail-scanner-1.23/qmail-scanner-queue.template	2004-08-20 10:34:40.000000000 +0900
@@ -260,6 +260,7 @@
 my @uufile_list = ();
 my @attachment_list = ();
 my @zipfile_list = ();
+my $sent_to_sender = '0';
 
 #Want microsec times for debugging
 use Time::HiRes qw( usleep ualarm gettimeofday tv_interval );
@@ -1402,7 +1403,17 @@
       }
     }
   } else {
-    $is_local="99";
+    if ($addr_type eq "lsndr") {
+      foreach $dom (@local_domains_array) {
+        #&debug("i_u_e: does $returnpath contain $dom?");
+        if ($returnpath =~ /$dom$/i) {
+	    #&debug("i_u_e: yes it does!");
+	      $is_local++;
+        }
+      }
+    } else {
+      $is_local="99";
+    }
     if (&automated_msg ) {
       #&debug("i_u_e: $addr_type is a mailing-list");
       return 1;
@@ -1419,6 +1430,26 @@
   }
 }
 
+sub consider_sender_local {
+  # Check if we need and are able to notify local senders
+  # Arg is lsndr, phsndr or any
+  my($sender_type) = @_;
+  if ( ($sender_type eq "any" && (&notify_addr('lsndr') || &notify_addr('phsndr'))) || ($sender_type ne "any" && &notify_addr($sender_type)) ) {
+    if (&notify_addr('phsndr') || $sender_type eq "phsndr") {
+      unless ($quarantine_event =~ /^(policy|perlscan)/i && $quarantine_event !~ /virus/i) {
+        &debug("c_s_l: should sender get alarm mail? ($sender_type) : No");
+        return 0;
+      }
+    }
+    if (!&is_unreplyable_email('lsndr')) {
+      &debug("c_s_l: should sender get alarm mail? ($sender_type) : Yes");
+      return 1;
+    }
+  }
+  &debug("c_s_l: should sender get alarm mail? ($sender_type) : No");
+  return 0;
+}
+
 sub email_quarantine_report {
   my($start_email_time)=[gettimeofday];
   &debug("e_v_r: quarantine  msg to $scandir/$vmaildir/new/$file_id");
@@ -1844,7 +1875,6 @@
   print "\n\n\n";
 }
 
-
 sub email_sender {
   #Don't e-mail bounced mail messages/etc!
   return if (&is_unreplyable_email('sender'));
@@ -1856,12 +1886,19 @@
   open(SM,"|$qmailinject -h -f ''")||&error_condition("cannot open $qmailinject for sending quarantine report - $!");
   print SM "From: \"$V_FROMNAME\" <$V_FROM>\n";
   if ($addr_type =~ /sender/) {
-    $addr_type='psender' if ($NOTIFY_ADDRS =~ /psender/);
+    if ($NOTIFY_ADDRS =~ /phsndr/) {
+      $addr_type='phsndr';
+    } elsif ($NOTIFY_ADDRS =~ /lsndr/) {
+      $addr_type='lsndr';
+    } elsif ($NOTIFY_ADDRS =~ /psender/) {
+      $addr_type='psender';
+    }
     if ($addr_type eq "sender") {
       if (!&is_unreplyable_email('sender') && &notify_addr('sender')) {
 	&debug("e_s: sending quarantine report via: $qmailinject to sender address ($returnpath)");
 	print SM "To: $returnpath\n";
 	$tmpsndrs = "$returnpath";
+	$sent_to_sender = '1';
       } else {
 	&debug("e_s: don't notify sender");
       }
@@ -1870,9 +1907,28 @@
 	&debug("e_s: sending policy quarantine report via: $qmailinject to psender address ($returnpath)");
 	print SM "To: $returnpath\n";
 	$tmpsndrs = "$returnpath";
+	$sent_to_sender = '1';
       } else {
 	&debug("e_s: don't notify psender");
       }
+    }elsif ($addr_type eq "lsndr") {
+      if (&consider_sender_local('lsndr')) {
+	&debug("e_s: sending policy quarantine report via: $qmailinject to lsndr address ($returnpath)");
+	print SM "To: $returnpath\n";
+	$tmpsndrs = "$returnpath";
+	$sent_to_sender = '1';
+      } else {
+	&debug("e_s: don't notify lsndr");
+      }
+    }elsif ($addr_type eq "phsndr") {
+      if (&consider_sender_local('phsndr')) {
+	&debug("e_s: sending policy quarantine report via: $qmailinject to phsndr address ($returnpath)");
+	print SM "To: $returnpath\n";
+	$tmpsndrs = "$returnpath";
+	$sent_to_sender = '1';
+      } else {
+	&debug("e_s: don't notify phsndr");
+      }
     } else {
       return;
     }
@@ -1917,7 +1973,7 @@
   print SM "MAILFROM: $headers{'MAILFROM'}\n";
   print SM "$HEADERS\n";
   print SM "---\n";
-  if ($addr_type ne "sender" ) {
+  if ($addr_type ne "sender" && $addr_type ne "lsndr" && $addr_type ne "phsndr") {
     print SM "\nLOCALE_sender_quarantine\n";
   }
   close(SM);
@@ -1961,11 +2017,14 @@
   }
   print SM "\n";
   print SM "LOCALE_attention: $recip\n";
-  if (!&is_unreplyable_email('recips')) {
-    if (&notify_addr('sender')) {
-      print SM "LOCALE_recips_not_automated_mail_note\n";
-    }
+  if ($sent_to_sender) {
+    &debug("e_r: has notified sender: Yes");
   } else {
+    &debug("e_r: has notified sender: No");
+  }
+  if (!&is_unreplyable_email('recips') && $sent_to_sender) {
+    print SM "LOCALE_recips_not_automated_mail_note\n";
+  } elsif (&automated_msg) {
     print SM "LOCALE_recips_automated_mail_note\n";
   }
   print SM "\nLOCALE_recips_explanation\n";
