diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2012-09-12 06:23:27 +0200 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2012-09-12 06:23:27 +0200 |
commit | ee2c1f16d6e24fa110939d0979e64f1a6f3db357 (patch) | |
tree | 2091c4adbb820ede1120677ae72bda8db5aa41e9 /extensions/RequestWhiner | |
parent | 3c44df8126d53937d0b8d53a96533f5c8cd01b44 (diff) | |
download | bugzilla-ee2c1f16d6e24fa110939d0979e64f1a6f3db357.tar.gz bugzilla-ee2c1f16d6e24fa110939d0979e64f1a6f3db357.tar.xz |
Bug 789873 - RequestWhiner doesn't respect SecureMail settings for "Outstanding Requests" mail
r=glob
Diffstat (limited to 'extensions/RequestWhiner')
-rwxr-xr-x | extensions/RequestWhiner/bin/whineatrequests.pl | 76 | ||||
-rw-r--r-- | extensions/RequestWhiner/template/en/default/requestwhiner/header.txt.tmpl | 6 |
2 files changed, 44 insertions, 38 deletions
diff --git a/extensions/RequestWhiner/bin/whineatrequests.pl b/extensions/RequestWhiner/bin/whineatrequests.pl index b7ac8f029..f7cb61dbb 100755 --- a/extensions/RequestWhiner/bin/whineatrequests.pl +++ b/extensions/RequestWhiner/bin/whineatrequests.pl @@ -34,6 +34,8 @@ use lib qw(. lib); use Bugzilla; use Bugzilla::User; use Bugzilla::Mailer; +use Email::MIME; + use Bugzilla::Extension::RequestWhiner::Constants; my $dbh = Bugzilla->dbh; @@ -66,7 +68,7 @@ $sth_get_requests->execute(); # Build data structure my $requests = {}; - + while (my ($login_name, $flag_name, $attach_id, @@ -77,11 +79,11 @@ while (my ($login_name, if (!defined($requests->{$login_name})) { $requests->{$login_name} = {}; } - + if (!defined($requests->{$login_name}->{$flag_name})) { $requests->{$login_name}->{$flag_name} = []; } - + push(@{ $requests->{$login_name}->{$flag_name} }, { bug_id => $bug_id, attach_id => $attach_id, @@ -117,39 +119,37 @@ exit; sub mail { my $args = shift; my $addressee = $args->{recipient}; - - my $template = - Bugzilla->template_inner($addressee->settings->{'lang'}->{'value'}); - my $msg = ''; # it's a temporary variable to hold the template output - $args->{'alternatives'} ||= []; - - # Put together the different multipart MIME segments - $template->process("requestwhiner/mail.txt.tmpl", $args, \$msg) - or die($template->error()); - push @{$args->{'alternatives'}}, - { - 'content' => $msg, - 'type' => 'text/plain', - }; - $msg = ''; - - $template->process("requestwhiner/mail.html.tmpl", $args, \$msg) - or die($template->error()); - push @{$args->{'alternatives'}}, - { - 'content' => $msg, - 'type' => 'text/html', - }; - $msg = ''; - - # Now produce a ready-to-mail MIME-encoded message - $args->{'boundary'} = "----------" . $$ . "--" . time() . "-----"; - - $template->process("whine/multipart-mime.txt.tmpl", $args, \$msg) - or die($template->error()); - - MessageToMTA($msg); - - delete $args->{'boundary'}; - delete $args->{'alternatives'}; + my $template = Bugzilla->template; + my ($content, @parts); + + $template->process("requestwhiner/mail.txt.tmpl", $args, \$content) + || die($template->error()); + push(@parts, Email::MIME->create( + attributes => { + content_type => "text/plain", + }, + body => $content, + )); + + $content = ''; + $template->process("requestwhiner/mail.html.tmpl", $args, \$content) + || die($template->error()); + + push(@parts, Email::MIME->create( + attributes => { + content_type => "text/html", + }, + body => $content, + )); + + $content = ''; + $template->process("requestwhiner/header.txt.tmpl", $args, \$content) + || die($template->error()); + + # TT trims the trailing newline + my $email = new Email::MIME("$content\n"); + $email->content_type_set('multipart/alternative'); + $email->parts_set(\@parts); + + MessageToMTA($email); } diff --git a/extensions/RequestWhiner/template/en/default/requestwhiner/header.txt.tmpl b/extensions/RequestWhiner/template/en/default/requestwhiner/header.txt.tmpl new file mode 100644 index 000000000..390fd3e2f --- /dev/null +++ b/extensions/RequestWhiner/template/en/default/requestwhiner/header.txt.tmpl @@ -0,0 +1,6 @@ +[% PROCESS global/variables.none.tmpl %] +From: [% from %] +To: [% recipient.email %] +Subject: [[% terms.Bugzilla %]] [% subject %] +X-Bugzilla-Type: whine + |