summaryrefslogtreecommitdiffstats
path: root/whine.pl
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-08-31 06:20:49 +0200
committerByron Jones <glob@mozilla.com>2015-08-31 06:20:49 +0200
commitfedc614940493768c53791939065fcf72ac5414b (patch)
tree4c3556fb667410cf1039168c1a17d3b90d7979c1 /whine.pl
parent48649030bf8536d8b9cf9df522c39438a06ec56c (diff)
downloadbugzilla-fedc614940493768c53791939065fcf72ac5414b.tar.gz
bugzilla-fedc614940493768c53791939065fcf72ac5414b.tar.xz
Bug 714724 - correctly encode emails as quoted-printable
r=LpSolit,a=sgreen
Diffstat (limited to 'whine.pl')
-rwxr-xr-xwhine.pl52
1 files changed, 10 insertions, 42 deletions
diff --git a/whine.pl b/whine.pl
index a7e3ee1cf..dfc405200 100755
--- a/whine.pl
+++ b/whine.pl
@@ -21,6 +21,7 @@ use Bugzilla::Constants;
use Bugzilla::Search;
use Bugzilla::User;
use Bugzilla::Mailer;
+use Bugzilla::MIME;
use Bugzilla::Util;
use Bugzilla::Group;
@@ -346,53 +347,20 @@ while (my $event = get_next_event) {
# - subject Subject line for the message
# - recipient user object for the recipient
# - author user object of the person who created the whine event
-#
-# In addition, mail adds two more fields to $args:
-# - alternatives array of hashes defining mime multipart types and contents
-# - boundary a MIME boundary generated using the process id and time
-#
sub mail {
my $args = shift;
- my $addressee = $args->{recipient};
# Don't send mail to someone whose bugmail notification is disabled.
- return if $addressee->email_disabled;
-
- my $template = Bugzilla->template_inner($addressee->setting('lang'));
- my $msg = ''; # it's a temporary variable to hold the template output
- $args->{'alternatives'} ||= [];
-
- # put together the different multipart mime segments
+ return if $args->{recipient}->email_disabled;
- $template->process("whine/mail.txt.tmpl", $args, \$msg)
- or die($template->error());
- push @{$args->{'alternatives'}},
+ $args->{to_user} = $args->{recipient};
+ MessageToMTA(generate_email(
+ $args,
{
- 'content' => $msg,
- 'type' => 'text/plain',
- };
- $msg = '';
-
- $template->process("whine/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'};
-
+ header => 'whine/header.txt.tmpl',
+ text => 'whine/mail.txt.tmpl',
+ html => 'whine/mail.html.tmpl',
+ }
+ ));
}
# run_queries runs all of the queries associated with a schedule ID, adding