my $msg = PerformSubsts($template, \%substs);
- my $sendmailparam = "-ODeliveryMode=deferred";
- if (Param("sendmailnow")) {
- $sendmailparam = "";
+ MessageToMTA($msg);
+
+ push(@sentlist, $person);
+ return 1;
+}
+
+# XXX: Should eventually add $mail_from and $mail_to options to
+# control the SMTP Envelope. -mkanat
+sub MessageToMTA ($) {
+ my ($msg) = (@_);
+
+ my $sendmailparam = "";
+ unless (Param("sendmailnow")) {
+ $sendmailparam = "-ODeliveryMode=deferred";
}
if ($enableSendMail == 1) {
open(SENDMAIL, "|/usr/lib/sendmail $sendmailparam -t -i") ||
die "Can't open sendmail";
-
+
print SENDMAIL trim($msg) . "\n";
close SENDMAIL;
}
- push(@sentlist, $person);
- return 1;
}
1;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Attachment;
+use Bugzilla::BugMail;
use constant TABLES_ALREADY_LOCKED => 1;
Bugzilla->cgi->header();
ThrowTemplateError($::template->error());
}
-
- my $delivery_mode = Param("sendmailnow") ? "" : "-ODeliveryMode=deferred";
- open(SENDMAIL, "|/usr/lib/sendmail $delivery_mode -t -i")
- || die "Can't open sendmail";
- print SENDMAIL $message;
- close(SENDMAIL);
+
+ Bugzilla::BugMail::MessageToMTA($message);
}
################################################################################
use Bugzilla::Config;
use Bugzilla::Error;
+use Bugzilla::BugMail;
use Date::Format;
$template->process("account/email/change-old.txt.tmpl", $vars, \$message)
|| ThrowTemplateError($template->error());
- open SENDMAIL, "|/usr/lib/sendmail -t -i";
- print SENDMAIL $message;
- close SENDMAIL;
+ Bugzilla::BugMail::MessageToMTA($message);
$vars->{'token'} = $newtoken;
$vars->{'emailaddress'} = $new_email . Param('emailsuffix');
$template->process("account/email/change-new.txt.tmpl", $vars, \$message)
|| ThrowTemplateError($template->error());
- open SENDMAIL, "|/usr/lib/sendmail -t -i";
- print SENDMAIL $message;
- close SENDMAIL;
-
+ Bugzilla::BugMail::MessageToMTA($message);
}
sub IssuePasswordToken {
$vars, \$message)
|| ThrowTemplateError($template->error());
- open SENDMAIL, "|/usr/lib/sendmail -t -i";
- print SENDMAIL $message;
- close SENDMAIL;
-
+ Bugzilla::BugMail::MessageToMTA($message);
}
$template->process("account/cancel-token.txt.tmpl", $vars, \$message)
|| ThrowTemplateError($template->error());
- open SENDMAIL, "|/usr/lib/sendmail -t -i";
- print SENDMAIL $message;
- close SENDMAIL;
+ Bugzilla::BugMail::MessageToMTA($message);
# Delete the token from the database.
&::SendSQL("LOCK TABLES tokens WRITE");
use Bugzilla::Config;
use Bugzilla::Constants;
use Bugzilla::Error;
+use Bugzilla::BugMail;
# Shut up misguided -w warnings about "used only once". For some reason,
# "use vars" chokes on me when I try it here.
"login" => $login,
"password" => $password});
- open SENDMAIL, "|/usr/lib/sendmail -t -i";
- print SENDMAIL $msg;
- close SENDMAIL;
+ Bugzilla::BugMail::MessageToMTA($msg);
}
sub PutHeader {
use Bugzilla::Util;
# Bring ChmodDataFile in until this is all moved to the module
use Bugzilla::Config qw(:DEFAULT ChmodDataFile $localconfig $datadir);
+use Bugzilla::BugMail;
# Shut up misguided -w warnings about "used only once". For some reason,
# "use vars" chokes on me when I try it here.
# Now lets send the e-mail to alert the user to the fact that their votes have
# been reduced or removed.
- my $sendmailparm = '-ODeliveryMode=deferred';
- if (Param('sendmailnow')) {
- $sendmailparm = '';
- }
- if (open(SENDMAIL, "|/usr/lib/sendmail $sendmailparm -t -i")) {
- my %substs;
+ my %substs;
- $substs{"to"} = $name . Param('emailsuffix');
- $substs{"bugid"} = $id;
- $substs{"reason"} = $reason;
+ $substs{"to"} = $name . Param('emailsuffix');
+ $substs{"bugid"} = $id;
+ $substs{"reason"} = $reason;
- $substs{"votesremoved"} = $removedvotes;
- $substs{"votesold"} = $oldvotes;
- $substs{"votesnew"} = $newvotes;
+ $substs{"votesremoved"} = $removedvotes;
+ $substs{"votesold"} = $oldvotes;
+ $substs{"votesnew"} = $newvotes;
- $substs{"votesremovedtext"} = $removedvotestext;
- $substs{"votesoldtext"} = $oldvotestext;
- $substs{"votesnewtext"} = $newvotestext;
+ $substs{"votesremovedtext"} = $removedvotestext;
+ $substs{"votesoldtext"} = $oldvotestext;
+ $substs{"votesnewtext"} = $newvotestext;
- $substs{"count"} = $removedvotes . "\n " . $newvotestext;
+ $substs{"count"} = $removedvotes . "\n " . $newvotestext;
- my $msg = PerformSubsts(Param("voteremovedmail"),
- \%substs);
- print SENDMAIL $msg;
- close SENDMAIL;
- }
+ my $msg = PerformSubsts(Param("voteremovedmail"),
+ \%substs);
+
+ Bugzilla::BugMail::MessageToMTA($msg);
}
SendSQL("SELECT SUM(vote_count) FROM votes WHERE bug_id = $id");
my $v = FetchOneColumn();
use Bugzilla;
use Bugzilla::Config qw(:DEFAULT $datadir);
+use Bugzilla::BugMail;
use XML::Parser;
use Data::Dumper;
$header.= "From: Bugzilla <$from>\n";
$header.= "Subject: $subject\n\n";
- open(SENDMAIL,
- "|/usr/lib/sendmail -ODeliveryMode=background -t -i") ||
- die "Can't open sendmail";
- print SENDMAIL $header . $message . "\n";
- close SENDMAIL;
+ my $sendmessage = $header . $message . "\n";
+ Bugzilla::BugMail::MessageToMTA($sendmessage);
Log($subject . " sent to: $to");
}
$msg .= "\n";
-open(SENDMAIL,
- "|/usr/lib/sendmail -ODeliveryMode=background -t -i") ||
- die "Can't open sendmail";
-print SENDMAIL $msg;
-close SENDMAIL;
+Bugzilla::BugMail::MessageToMTA($msg);
my $logstr = "XML: bugs $buglist sent to $to";
Log($logstr);
require "globals.pl";
+use Bugzilla::BugMail;
+
SendSQL("select bug_id,short_desc,login_name from bugs,profiles where " .
"(bug_status = 'NEW' or bug_status = 'REOPENED') and " .
"to_days(now()) - to_days(delta_ts) > " . Param('whinedays') .
$msg .= " -> ${urlbase}show_bug.cgi?id=$i\n";
}
- my $sendmailparam = Param('sendmailnow') ? '' : "-ODeliveryMode=deferred";
- open SENDMAIL, "|/usr/lib/sendmail $sendmailparam -t -i"
- or die "Can't open sendmail";
- print SENDMAIL $msg;
- close SENDMAIL;
+ Bugzilla::BugMail::MessageToMTA($msg);
+
print "$email " . join(" ", @{$bugs{$email}}) . "\n";
}