diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2015-10-23 15:25:19 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2015-10-23 15:25:19 +0200 |
commit | 948b58060560b15982da3078ce0595227aef723e (patch) | |
tree | d84217f333e5013ade8530765d459a51be92a10d /Bugzilla/BugMail.pm | |
parent | 3b29cba48914451664ed3aab560fd26973e43b0a (diff) | |
download | bugs-948b58060560b15982da3078ce0595227aef723e.tar bugs-948b58060560b15982da3078ce0595227aef723e.tar.gz bugs-948b58060560b15982da3078ce0595227aef723e.tar.bz2 bugs-948b58060560b15982da3078ce0595227aef723e.tar.xz bugs-948b58060560b15982da3078ce0595227aef723e.zip |
Bug 714724: Correctly encode emails as quoted-printable
r=dkl a=sgreen
Diffstat (limited to 'Bugzilla/BugMail.pm')
-rw-r--r-- | Bugzilla/BugMail.pm | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index 9ebf3ea7d..d4a1597ab 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -19,6 +19,7 @@ use Bugzilla::Bug; use Bugzilla::Comment; use Bugzilla::Mailer; use Bugzilla::Hook; +use Bugzilla::MIME; use Date::Parse; use Date::Format; @@ -435,6 +436,7 @@ sub _generate_bugmail { my $user = $vars->{to_user}; my $template = Bugzilla->template_inner($user->setting('lang')); my ($msg_text, $msg_html, $msg_header); + state $use_utf8 = Bugzilla->params->{'utf8'}; $template->process("email/bugmail-header.txt.tmpl", $vars, \$msg_header) || ThrowTemplateError($template->error()); @@ -442,32 +444,35 @@ sub _generate_bugmail { || ThrowTemplateError($template->error()); my @parts = ( - Email::MIME->create( + Bugzilla::MIME->create( attributes => { - content_type => "text/plain", + content_type => 'text/plain', + charset => $use_utf8 ? 'UTF-8' : 'iso-8859-1', + encoding => 'quoted-printable', }, - body => $msg_text, + body_str => $msg_text, ) ); if ($user->setting('email_format') eq 'html') { $template->process("email/bugmail.html.tmpl", $vars, \$msg_html) || ThrowTemplateError($template->error()); - push @parts, Email::MIME->create( + push @parts, Bugzilla::MIME->create( attributes => { - content_type => "text/html", + content_type => 'text/html', + charset => $use_utf8 ? 'UTF-8' : 'iso-8859-1', + encoding => 'quoted-printable', }, - body => $msg_html, + body_str => $msg_html, ); } - # TT trims the trailing newline, and threadingmarker may be ignored. - my $email = new Email::MIME("$msg_header\n"); + my $email = Bugzilla::MIME->new($msg_header); if (scalar(@parts) == 1) { $email->content_type_set($parts[0]->content_type); } else { $email->content_type_set('multipart/alternative'); # Some mail clients need same encoding for each part, even empty ones. - $email->charset_set('UTF-8') if Bugzilla->params->{'utf8'}; + $email->charset_set('UTF-8') if $use_utf8; } $email->parts_set(\@parts); return $email; |