From 86c887fd597a3275ea6485d3816aeedfc473ea16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Fri, 16 Jul 2004 02:22:11 +0000 Subject: [PATCH] take out spurious warning improve address parsing a bit to make it easier to add parsing of MAIL FROM extensions git-svn-id: https://svn.perl.org/qpsmtpd/trunk@263 958fd67b-6ff1-0310-b445-bb7760255be9 --- lib/Qpsmtpd/SMTP.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Qpsmtpd/SMTP.pm b/lib/Qpsmtpd/SMTP.pm index 88b7b0c..79c8e83 100644 --- a/lib/Qpsmtpd/SMTP.pm +++ b/lib/Qpsmtpd/SMTP.pm @@ -226,8 +226,13 @@ sub mail { else { my $from_parameter = join " ", @_; $self->log(LOGINFO, "full from_parameter: $from_parameter"); - my ($from) = ($from_parameter =~ m/^from:\s*(\S+)/i)[0]; - warn "$$ from email address : [$from]\n"; + + my ($from) = ($from_parameter =~ m/^from:\s*(<[^>]+>)/i)[0]; + + # support addresses without <> ... maybe we shouldn't? + ($from) = "<" . ($from_parameter =~ m/^from:\s*(\S+)/i)[0] . ">" + unless $from; + if ($from eq "<>" or $from =~ m/\[undefined\]/) { $from = Qpsmtpd::Address->new("<>"); }