summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorgerv%gerv.net <>2005-01-01 22:44:15 +0100
committergerv%gerv.net <>2005-01-01 22:44:15 +0100
commit4e2bfc82a0a1d70e3e0e79d27b9bcee8dfc25077 (patch)
tree7995ebb2391debcd774e93aab16411e04df8e28d /Bugzilla
parentb9cfd23ffdca5cf3efc90f19471c553085f4c913 (diff)
downloadbugzilla-4e2bfc82a0a1d70e3e0e79d27b9bcee8dfc25077.tar.gz
bugzilla-4e2bfc82a0a1d70e3e0e79d27b9bcee8dfc25077.tar.xz
Bug 59351 - move all calls to sendmail to a central place. Patch by mkanat; r=gerv,vladd; a=justdave.
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/BugMail.pm21
-rw-r--r--Bugzilla/Flag.pm9
-rw-r--r--Bugzilla/Token.pm19
3 files changed, 23 insertions, 26 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index 0e089fa12..638b8a413 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -864,20 +864,29 @@ sub NewProcessOnePerson ($$$$$$$$$$$$$) {
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;
diff --git a/Bugzilla/Flag.pm b/Bugzilla/Flag.pm
index 1ee6ba71c..8fa1e9457 100644
--- a/Bugzilla/Flag.pm
+++ b/Bugzilla/Flag.pm
@@ -36,6 +36,7 @@ use Bugzilla::Config;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Attachment;
+use Bugzilla::BugMail;
use constant TABLES_ALREADY_LOCKED => 1;
@@ -637,12 +638,8 @@ sub notify {
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);
}
################################################################################
diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm
index 55362d184..90efe99bd 100644
--- a/Bugzilla/Token.pm
+++ b/Bugzilla/Token.pm
@@ -31,6 +31,7 @@ package Bugzilla::Token;
use Bugzilla::Config;
use Bugzilla::Error;
+use Bugzilla::BugMail;
use Date::Format;
@@ -91,9 +92,7 @@ sub IssueEmailChangeToken {
$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');
@@ -102,10 +101,7 @@ sub IssueEmailChangeToken {
$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 {
@@ -157,10 +153,7 @@ sub IssuePasswordToken {
$vars, \$message)
|| ThrowTemplateError($template->error());
- open SENDMAIL, "|/usr/lib/sendmail -t -i";
- print SENDMAIL $message;
- close SENDMAIL;
-
+ Bugzilla::BugMail::MessageToMTA($message);
}
@@ -236,9 +229,7 @@ sub Cancel {
$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");