summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <dev@blino.org>2016-02-16 00:26:53 +0100
committerOlivier Blin <dev@blino.org>2016-02-16 00:26:53 +0100
commit4bdbe330ed162fe4b29be0f85dbc64c00fea9d34 (patch)
treec83baf5c4d77ee2eeb69a3b29508543a4e534e45
parentb7e46e595d65aaf31efc8c866c09364a410e239d (diff)
downloadbugzilla-4bdbe330ed162fe4b29be0f85dbc64c00fea9d34.tar
bugzilla-4bdbe330ed162fe4b29be0f85dbc64c00fea9d34.tar.gz
bugzilla-4bdbe330ed162fe4b29be0f85dbc64c00fea9d34.tar.bz2
bugzilla-4bdbe330ed162fe4b29be0f85dbc64c00fea9d34.tar.xz
bugzilla-4bdbe330ed162fe4b29be0f85dbc64c00fea9d34.zip
Properly encode From header
Bugzilla emails could have been rejected because the From header was not properly encoded (for example when containing "é" characters): Oct 25 12:08:43 alamut postfix/smtp[7614]: 0F85B5AD2B: to=<mageia@blino.org>, relay=eforward3.registrar-servers.com[38.101.213.206]:25, delay=2.7, delays=0.01/0/0.99/1.7, dsn=5.0.0, status=bounced (host eforward3.registrar-servers.com[38.101.213.206] said: 550 From contains invalid characters. (in reply to end of DATA command))
-rw-r--r--Extension.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/Extension.pm b/Extension.pm
index 4141e7c..6212367 100644
--- a/Extension.pm
+++ b/Extension.pm
@@ -15,6 +15,7 @@ use Bugzilla::User;
use Bugzilla::Extension::Mageia::Util;
use Email::Address;
+use Encode qw(encode);
our $VERSION = '0.10';
@@ -87,7 +88,7 @@ sub mailer_before_send {
$changer = Bugzilla::User->new({ name => $changer });
my $changer_name = $changer ? $changer->name : undef;
my $address = Email::Address->new($changer_name, $email->header('From'));
- $email->header_set('From', $address->format);
+ $email->header_set('From', encode("MIME_Header", $address->format));
}
}