From 4abcdea1d2f67a14fb4f89b0bb47fe16974ab80a Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Tue, 24 Jul 2007 04:58:59 +0000 Subject: [PATCH] Treat email from <> as a bounce --- sendmail/autoreply.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sendmail/autoreply.pl b/sendmail/autoreply.pl index f6833de88..88bf41259 100755 --- a/sendmail/autoreply.pl +++ b/sendmail/autoreply.pl @@ -29,9 +29,14 @@ if (!$config{'sendmail_path'}) { } # read headers and body +$lnum = 0; while() { s/\r|\n//g; - if (/^(\S+):\s+(.*)/) { + if (/^From\s+(\S+)/ && $lnum == 0) { + # Magic From line + $fromline = $1; + } + elsif (/^(\S+):\s+(.*)/) { $header{lc($1)} = $2; $lastheader = lc($1); } @@ -39,6 +44,7 @@ while() { $header{$lastheader} .= $_; } elsif (!$_) { last; } + $lnum++; } while() { $body .= $_; @@ -55,7 +61,8 @@ if ($header{'x-mailing-list'} || # Do nothing if post is from a mailing list exit 0; } -if ($header{'from'} =~ /postmaster|mailer-daemon/i) { +if ($header{'from'} =~ /postmaster|mailer-daemon/i || + $fromline =~ /postmaster|mailer-daemon|<>/ ) { # Do nothing if post is a bounce exit 0; }