diff options
author | Byron Jones <bjones@mozilla.com> | 2011-11-30 17:14:10 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2011-11-30 17:14:10 +0100 |
commit | 67df20a35e068e368a27165342a5b1ed00df2cb6 (patch) | |
tree | 6c08d89ecf58f4559270d0b72867819f9b5a6d04 | |
parent | 306fbbaaf53e940755fb38faf923e54fb931e132 (diff) | |
download | bugzilla-67df20a35e068e368a27165342a5b1ed00df2cb6.tar.gz bugzilla-67df20a35e068e368a27165342a5b1ed00df2cb6.tar.xz |
Bug 696005: Fix encoding of emails when modified by extensions
-rw-r--r-- | Bugzilla/Mailer.pm | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index 5ee6fd2eb..b8efd2931 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -87,25 +87,6 @@ sub MessageToMTA { # thus to hopefully avoid auto replies. $email->header_set('Auto-Submitted', 'auto-generated'); - $email->walk_parts(sub { - my ($part) = @_; - return if $part->parts > 1; # Top-level - my $content_type = $part->content_type || ''; - if ($content_type !~ /;/) { - my $body = $part->body; - if (Bugzilla->params->{'utf8'}) { - $part->charset_set('UTF-8'); - # encoding_set works only with bytes, not with utf8 strings. - my $raw = $part->body_raw; - if (utf8::is_utf8($raw)) { - utf8::encode($raw); - $part->body_set($raw); - } - } - $part->encoding_set('quoted-printable') if !is_7bit_clean($body); - } - }); - # MIME-Version must be set otherwise some mailsystems ignore the charset $email->header_set('MIME-Version', '1.0') if !$email->header('MIME-Version'); @@ -170,6 +151,25 @@ sub MessageToMTA { Bugzilla::Hook::process('mailer_before_send', { email => $email, mailer_args => \@args }); + $email->walk_parts(sub { + my ($part) = @_; + return if $part->parts > 1; # Top-level + my $content_type = $part->content_type || ''; + if ($content_type !~ /;/) { + my $body = $part->body; + if (Bugzilla->params->{'utf8'}) { + $part->charset_set('UTF-8'); + # encoding_set works only with bytes, not with utf8 strings. + my $raw = $part->body_raw; + if (utf8::is_utf8($raw)) { + utf8::encode($raw); + $part->body_set($raw); + } + } + $part->encoding_set('quoted-printable') if !is_7bit_clean($body); + } + }); + if ($method eq "Test") { my $filename = bz_locations()->{'datadir'} . '/mailer.testfile'; open TESTFILE, '>>', $filename; |