From 3ccde2aa6f7ab81a76fefdb0c7d2d6160767ff75 Mon Sep 17 00:00:00 2001
From: "travis%sedsystems.ca" <>
Date: Thu, 10 Mar 2005 01:10:00 +0000
Subject: [PATCH] Bug 284629 : Combine Param(enable_mail_sending) with
 Param(maildeliverymethod) Patch by Shane H. W. Travis <travis@sedsystems.ca> 
 r=Jake  a=myk

---
 Bugzilla/BugMail.pm | 10 +++++-----
 checksetup.pl       |  6 +++---
 defparams.pl        | 28 ++++++++++++----------------
 3 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index a0c11ef20..1221dcfbc 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -883,17 +883,17 @@ sub NewProcessOnePerson ($$$$$$$$$$$$$) {
 
 sub MessageToMTA ($) {
     my ($msg) = (@_);
-    return unless Param('enable_mail_sending');
+    return if (Param('mail_delivery_method') eq "none");
 
     my @args;
-    if (Param("maildeliverymethod") eq "sendmail" && !Param("sendmailnow")) {
+    if (Param("mail_delivery_method") eq "sendmail" && !Param("sendmailnow")) {
         push @args, "-ODeliveryMode=deferred";
     }
-    if (Param("maildeliverymethod") eq "smtp") {
+    if (Param("mail_delivery_method") eq "smtp") {
         push @args, Server => Param("smtpserver");
     }
-    my $mailer = new Mail::Mailer Param("maildeliverymethod"), @args;
-    if (Param("maildeliverymethod") eq "testfile") {
+    my $mailer = new Mail::Mailer Param("mail_delivery_method"), @args;
+    if (Param("mail_delivery_method") eq "testfile") {
         $Mail::Mailer::testfile::config{outfile} = "$datadir/mailer.testfile";
     }
     
diff --git a/checksetup.pl b/checksetup.pl
index 7fda5c978..1464e8516 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -1282,10 +1282,10 @@ if (@oldparams) {
     close PARAMFILE;
 }
 
-# Set maildeliverymethod to SMTP and prompt for SMTP server
+# Set mail_delivery_method to SMTP and prompt for SMTP server
 # if running on Windows and set to sendmail (Mail::Mailer doesn't
 # support sendmail on Windows)
-if ($^O =~ /MSWin32/i && Param('maildeliverymethod') eq 'sendmail') {
+if ($^O =~ /MSWin32/i && Param('mail_delivery_method') eq 'sendmail') {
     print "\nBugzilla requires an SMTP server to function on Windows.\n" .
         "Please enter your SMTP server's hostname: ";
     my $smtp = $answer{'SMTP_SERVER'} 
@@ -1296,7 +1296,7 @@ if ($^O =~ /MSWin32/i && Param('maildeliverymethod') eq 'sendmail') {
         print "\nWarning: No SMTP Server provided, defaulting to localhost\n";
         $smtp = 'localhost';
     }
-    SetParam('maildeliverymethod', 'smtp');
+    SetParam('mail_delivery_method', 'smtp');
     SetParam('smtpserver', $smtp);
 }
 
diff --git a/defparams.pl b/defparams.pl
index b31f18397..af5715235 100644
--- a/defparams.pl
+++ b/defparams.pl
@@ -671,24 +671,20 @@ sub find_languages {
   },
 
   {
-   name => 'enable_mail_sending',
-   desc => 'If set to \'Off\', Bugzilla will not send out any email of any ' .
-           'type whatsoever.<br>For most administrators, it is useful to ' .
-           'be able to disable all mail during testing and initial setup, ' .
-           'but other than that they will want to leave it \'On\'.',
-   type => 'b',
-   default => 1
-  },
-
-  {
-   name => 'maildeliverymethod',
-   desc => 'The method used for mail delivery. The testfile method ' .
-           'is useful for debugging (for more information see the ' .
-           'Mail::Mailer manual)',
+   name => 'mail_delivery_method',
+   desc => 'Defines how email is sent, or if it is sent at all.<br><ul>' .
+           '<li>\'sendmail\', \'smtp\' and \'qmail\' are all MTAs. ' .
+           '(only SMTP is available in Windows.)</li>' .
+           '<li>\'testfile\' is useful for debugging: all email is stored' .
+           'in data/mailer.testfile instead of being sent. For more ' .
+           'information, see the Mail::Mailer manual.</li>' .
+           '<li>\'none\' will completely disable email. Bugzilla continues ' .
+           'to act as though it is sending mail, but nothing is sent or ' .
+           'stored.</li></ul>' ,
    type => 's',
    choices => $^O =~ /MSWin32/i 
-                  ? ['smtp', 'testfile']
-                  : ['sendmail', 'smtp', 'qmail', 'testfile'],
+                  ? ['smtp', 'testfile', 'none']
+                  : ['sendmail', 'smtp', 'qmail', 'testfile', 'none'],
    default => 'sendmail',
    checker => \&check_multi
   },
-- 
2.24.1