From 976e419c3fb0d24e509513e9afe7883ac0367dba Mon Sep 17 00:00:00 2001 From: vfilippov Date: Thu, 1 Apr 2010 13:53:45 +0000 Subject: [PATCH] Properly encode From: header git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@700 6955db30-a419-402b-8a0d-67ecbb4d7f56 --- Bugzilla/Mailer.pm | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index b8f61fc4d..7fb76ceba 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -130,6 +130,8 @@ sub MessageToMTA { } my $from = $email->header('From'); + my $from_obj = $from ? [Email::Address->parse($from)]->[0] : undef; + $from_obj and $email->header_set('From', encode('MIME-Header', $from_obj->name) . ' <' . $from_obj->address . '>'); my ($hostname, @args); if ($method eq "Sendmail") { @@ -138,15 +140,9 @@ sub MessageToMTA { } push @args, "-i"; # We want to make sure that we pass *only* an email address. - if ($from) { - my ($email_obj) = Email::Address->parse($from); - if ($email_obj) { - my $from_email = $email_obj->address; - push(@args, "-f$from_email") if $from_email; - } - } - push(@args, "-ODeliveryMode=deferred") - if !Bugzilla->params->{"sendmailnow"}; + push @args, "-f" . $from_obj->address if $from_obj; + push @args, "-ODeliveryMode=deferred" + unless Bugzilla->params->{"sendmailnow"}; } else { # Sendmail adds a Date: header also, but others may not.