From 2afcdb261b2a90013f39b6c1eb578b57a4a8dc85 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Mon, 28 Jan 2008 00:13:09 +0000 Subject: [PATCH] Bug 411544: Subject lines in emails were still being improperly line-broken. This patch makes encoded headers not break at all. Patch By Jeff Lawson r=mkanat, a=mkanat --- Bugzilla/Mailer.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index 956f30139d..8e18d5e319 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -44,6 +44,7 @@ use Bugzilla::Util; use Date::Format qw(time2str); use Encode qw(encode); +use Encode::MIME::Header; use Email::Address; use Email::MIME; # Loading this gives us encoding_set. @@ -68,9 +69,11 @@ sub MessageToMTA { foreach my $header qw(From To Cc Reply-To Sender Errors-To Subject) { if (my $value = $email->header($header)) { $value = Encode::decode("UTF-8", $value) if Bugzilla->params->{'utf8'}; + + # avoid excessive line wrapping done by Encode. + local $Encode::Encoding{'MIME-Q'}->{'bpl'} = 998; + my $encoded = encode('MIME-Q', $value); - # Encode adds unnecessary line breaks, with two spaces after each. - $encoded =~ s/\n / /g; $email->header_set($header, $encoded); } } -- 2.47.2