From c3be4b9c6bfee9f13784ca528354c551ebbdaec0 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 14 Jul 2013 22:56:32 +0800 Subject: [PATCH] Allow setting of SMTP port --- webmin/edit_sendmail.cgi | 5 ++++- webmin/lang/en | 2 ++ webmin/save_sendmail.cgi | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/webmin/edit_sendmail.cgi b/webmin/edit_sendmail.cgi index 112942608..881826641 100755 --- a/webmin/edit_sendmail.cgi +++ b/webmin/edit_sendmail.cgi @@ -20,11 +20,14 @@ print &ui_table_row($text{'sendmail_system'}, $smtp = $mconfig{'send_mode'}; $mode = $smtp eq "" ? 0 : $smtp eq "localhost" || $smtp eq "127.0.0.1" ? 1 : 2; +$port = ($mode == 2 ? $mconfig{'smtp_port'} : undef) || 25; print &ui_table_row($text{'sendmail_smtp'}, &ui_radio("mode", $mode, [ [ 0, $text{'sendmail_smtp0'}."
" ], [ 1, $text{'sendmail_smtp1'}."
" ], [ 2, $text{'sendmail_smtp2'} ] ]). - " ".&ui_textbox("smtp", $mode == 2 ? $smtp : "", 40)); + " ".&ui_textbox("smtp", $mode == 2 ? $smtp : "", 40). + " ".$text{'sendmail_port'}. + " ".&ui_textbox("port", $port, 6)); # SMTP login and password $user = $mconfig{'smtp_user'}; diff --git a/webmin/lang/en b/webmin/lang/en index e1f256244..e7c7275ee 100644 --- a/webmin/lang/en +++ b/webmin/lang/en @@ -949,6 +949,7 @@ sendmail_desc=This page controls how Webmin sends email, such as from scheduled sendmail_header=Mail sending options sendmail_system=Local mail server sendmail_smtp=Send email using +sendmail_port=on port sendmail_smtp0=Local mail server command sendmail_smtp1=Via SMTP to local mail server sendmail_smtp2=Via SMTP to remote mail server @@ -962,6 +963,7 @@ sendmail_fromdef=Default ($1) sendmail_fromaddr=Address sendmail_err=Failed to save mail sending options sendmail_esmtp=Missing or un-resolvable SMTP server hostname +sendmail_eport=Missing or non-numeric SMTP port sendmail_elogin=Missing SMTP server login sendmail_esasl=SMTP authentication cannot be enabled unless the $2 Perl module is installed. sendmail_efrom=Missing or incorrectly formatted from address diff --git a/webmin/save_sendmail.cgi b/webmin/save_sendmail.cgi index 6aa06469b..b0d92ce43 100755 --- a/webmin/save_sendmail.cgi +++ b/webmin/save_sendmail.cgi @@ -19,6 +19,13 @@ else { &to_ipaddress($in{'smtp'}) || &to_ip6address($in{'smtp'}) || &error($text{'sendmail_esmtp'}); $mconfig{'send_mode'} = $in{'smtp'}; + $in{'port'} =~ /^\d+$/ || &error($text{'sendmail_eport'}); + if ($in{'port'} == 25) { + delete($mconfig{'smtp_port'}); + } + else { + $mconfig{'smtp_port'} = $in{'port'}; + } } # Save login and password