Commit 3ccde2aa authored by travis%sedsystems.ca's avatar travis%sedsystems.ca

Bug 284629 : Combine Param(enable_mail_sending) with Param(maildeliverymethod)

Patch by Shane H. W. Travis <travis@sedsystems.ca> r=Jake a=myk
parent 56c49739
...@@ -883,17 +883,17 @@ sub NewProcessOnePerson ($$$$$$$$$$$$$) { ...@@ -883,17 +883,17 @@ sub NewProcessOnePerson ($$$$$$$$$$$$$) {
sub MessageToMTA ($) { sub MessageToMTA ($) {
my ($msg) = (@_); my ($msg) = (@_);
return unless Param('enable_mail_sending'); return if (Param('mail_delivery_method') eq "none");
my @args; my @args;
if (Param("maildeliverymethod") eq "sendmail" && !Param("sendmailnow")) { if (Param("mail_delivery_method") eq "sendmail" && !Param("sendmailnow")) {
push @args, "-ODeliveryMode=deferred"; push @args, "-ODeliveryMode=deferred";
} }
if (Param("maildeliverymethod") eq "smtp") { if (Param("mail_delivery_method") eq "smtp") {
push @args, Server => Param("smtpserver"); push @args, Server => Param("smtpserver");
} }
my $mailer = new Mail::Mailer Param("maildeliverymethod"), @args; my $mailer = new Mail::Mailer Param("mail_delivery_method"), @args;
if (Param("maildeliverymethod") eq "testfile") { if (Param("mail_delivery_method") eq "testfile") {
$Mail::Mailer::testfile::config{outfile} = "$datadir/mailer.testfile"; $Mail::Mailer::testfile::config{outfile} = "$datadir/mailer.testfile";
} }
......
...@@ -1282,10 +1282,10 @@ if (@oldparams) { ...@@ -1282,10 +1282,10 @@ if (@oldparams) {
close PARAMFILE; 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 # if running on Windows and set to sendmail (Mail::Mailer doesn't
# support sendmail on Windows) # 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" . print "\nBugzilla requires an SMTP server to function on Windows.\n" .
"Please enter your SMTP server's hostname: "; "Please enter your SMTP server's hostname: ";
my $smtp = $answer{'SMTP_SERVER'} my $smtp = $answer{'SMTP_SERVER'}
...@@ -1296,7 +1296,7 @@ if ($^O =~ /MSWin32/i && Param('maildeliverymethod') eq 'sendmail') { ...@@ -1296,7 +1296,7 @@ if ($^O =~ /MSWin32/i && Param('maildeliverymethod') eq 'sendmail') {
print "\nWarning: No SMTP Server provided, defaulting to localhost\n"; print "\nWarning: No SMTP Server provided, defaulting to localhost\n";
$smtp = 'localhost'; $smtp = 'localhost';
} }
SetParam('maildeliverymethod', 'smtp'); SetParam('mail_delivery_method', 'smtp');
SetParam('smtpserver', $smtp); SetParam('smtpserver', $smtp);
} }
......
...@@ -671,24 +671,20 @@ sub find_languages { ...@@ -671,24 +671,20 @@ sub find_languages {
}, },
{ {
name => 'enable_mail_sending', name => 'mail_delivery_method',
desc => 'If set to \'Off\', Bugzilla will not send out any email of any ' . desc => 'Defines how email is sent, or if it is sent at all.<br><ul>' .
'type whatsoever.<br>For most administrators, it is useful to ' . '<li>\'sendmail\', \'smtp\' and \'qmail\' are all MTAs. ' .
'be able to disable all mail during testing and initial setup, ' . '(only SMTP is available in Windows.)</li>' .
'but other than that they will want to leave it \'On\'.', '<li>\'testfile\' is useful for debugging: all email is stored' .
type => 'b', 'in data/mailer.testfile instead of being sent. For more ' .
default => 1 '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>' ,
name => 'maildeliverymethod',
desc => 'The method used for mail delivery. The testfile method ' .
'is useful for debugging (for more information see the ' .
'Mail::Mailer manual)',
type => 's', type => 's',
choices => $^O =~ /MSWin32/i choices => $^O =~ /MSWin32/i
? ['smtp', 'testfile'] ? ['smtp', 'testfile', 'none']
: ['sendmail', 'smtp', 'qmail', 'testfile'], : ['sendmail', 'smtp', 'qmail', 'testfile', 'none'],
default => 'sendmail', default => 'sendmail',
checker => \&check_multi checker => \&check_multi
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment