summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2011-11-30 07:02:19 +0100
committerByron Jones <bjones@mozilla.com>2011-11-30 07:02:19 +0100
commit67aa58df76f0977e8d6aade1b24fbecc26e5433e (patch)
tree9ace4f4ef75412a6d5fc7cc28d5209c9d153c1b4
parent10f628208f29a36ffe4e0c3e2be4f5ae824edbaf (diff)
downloadbugzilla-67aa58df76f0977e8d6aade1b24fbecc26e5433e.tar.gz
bugzilla-67aa58df76f0977e8d6aade1b24fbecc26e5433e.tar.xz
Bug 696005: Fix encoding of emails after extensions have hooked the email, not before
r=dkl, a=mkanat
-rw-r--r--Bugzilla/Mailer.pm38
1 files changed, 19 insertions, 19 deletions
diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm
index 699467ed8..91530ce20 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');
@@ -171,6 +152,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;