summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2012-01-25 07:57:33 +0100
committerByron Jones <bjones@mozilla.com>2012-01-25 07:57:33 +0100
commitef4ee7e3359102d50b65fb843d672323b06b717b (patch)
treea5ab5b5e6d2996788c81233d8502faabf5f179ae /Bugzilla
parentcd73cd98c5f214357b8e2967f9e609837a2abf68 (diff)
downloadbugzilla-ef4ee7e3359102d50b65fb843d672323b06b717b.tar.gz
bugzilla-ef4ee7e3359102d50b65fb843d672323b06b717b.tar.xz
Bug 714724: encode emails as 8bit instead of quoted-printable
r=mkanat, a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Mailer.pm29
1 files changed, 10 insertions, 19 deletions
diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm
index 10a456dd6..1e4079488 100644
--- a/Bugzilla/Mailer.pm
+++ b/Bugzilla/Mailer.pm
@@ -83,6 +83,16 @@ sub MessageToMTA {
}
}
+ $email->walk_parts(sub {
+ my ($part) = @_;
+ return if $part->parts > 1; # Top-level
+ my $content_type = $part->content_type || '';
+ if ($content_type !~ /;/) {
+ $part->charset_set('UTF-8') if Bugzilla->params->{'utf8'};
+ $part->encoding_set('8bit') if !is_7bit_clean($part->body);
+ }
+ });
+
my $from = $email->header('From');
my ($hostname, @args);
@@ -127,25 +137,6 @@ 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;