diff options
author | Ed Morley <emorley@mozilla.com> | 2015-03-19 08:16:30 +0100 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-03-19 08:16:30 +0100 |
commit | 6638a015487885a47bb0ba851865ef8b073d08fb (patch) | |
tree | 114070587bef8d7eb8dbc1f833258adbcd73dafd /Bugzilla/BugMail.pm | |
parent | 2f65ef51e9ba430783a2d9ef06e0aa0af041d510 (diff) | |
download | bugzilla-6638a015487885a47bb0ba851865ef8b073d08fb.tar.gz bugzilla-6638a015487885a47bb0ba851865ef8b073d08fb.tar.xz |
Bug 1105568: Add support for HTML flagmail
r=glob,a=glob
Diffstat (limited to 'Bugzilla/BugMail.pm')
-rw-r--r-- | Bugzilla/BugMail.pm | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index df39bd108..f655c4ae6 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -437,45 +437,12 @@ sub _flatten_object { sub _generate_bugmail { my ($vars) = @_; - my $user = $vars->{to_user}; - my $template = Bugzilla->template_inner($user->setting('lang')); - my ($msg_text, $msg_html, $msg_header); - - $template->process("email/bugmail-header.txt.tmpl", $vars, \$msg_header) - || ThrowTemplateError($template->error()); - $template->process("email/bugmail.txt.tmpl", $vars, \$msg_text) - || ThrowTemplateError($template->error()); - - my @parts = ( - Email::MIME->create( - attributes => { - content_type => "text/plain", - }, - body => $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( - attributes => { - content_type => "text/html", - }, - body => $msg_html, - ); - } - - # TT trims the trailing newline, and threadingmarker may be ignored. - my $email = new Email::MIME("$msg_header\n"); - 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'); - } - $email->parts_set(\@parts); - return $email; + my $templates = { + header => "email/bugmail-header.txt.tmpl", + text => "email/bugmail.txt.tmpl", + html => "email/bugmail.html.tmpl", + }; + return generate_email($vars, $templates); } sub _get_diffs { |