diff options
-rw-r--r-- | etc/inc/notices.inc | 11 | ||||
-rwxr-xr-x | usr/local/www/index.php | 2 | ||||
-rw-r--r-- | usr/local/www/system_advanced_notifications.php | 37 |
3 files changed, 47 insertions, 3 deletions
diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc index 069b281..278d4f4 100644 --- a/etc/inc/notices.inc +++ b/etc/inc/notices.inc @@ -297,6 +297,17 @@ function notify_via_smtp($message) { $smtp->ssl = 0; $smtp->debug = 0; $smtp->html_debug = 0; + + if($config['notifications']['smtp']['fromaddress']) + $from = $config['notifications']['smtp']['fromaddress']; + + // Use SMTP Auth if fields are filled out + if($config['notifications']['smtp']['username'] && + $config['notifications']['smtp']['password']) { + $smtp->authentication_mechanism = "PLAIN"; + $smtp->username = $config['notifications']['smtp']['username']; + $smtp->password = $config['notifications']['smtp']['password']; + } $headers = array( "From: {$from}", diff --git a/usr/local/www/index.php b/usr/local/www/index.php index 374160f..1a37f76 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -424,7 +424,7 @@ $closehead = false; ## Set Page Title and Include Header $pgtitle = array("{$g['product_name']} Dashboard"); include("head.inc"); - +outputJavaScriptFileInline("javascript/scriptaculous/prototype.js"); outputJavaScriptFileInline("javascript/domTT/domLib.js"); outputJavaScriptFileInline("javascript/domTT/domTT.js"); outputJavaScriptFileInline("javascript/domTT/behaviour.js"); diff --git a/usr/local/www/system_advanced_notifications.php b/usr/local/www/system_advanced_notifications.php index 5a53ab2..c9917ce 100644 --- a/usr/local/www/system_advanced_notifications.php +++ b/usr/local/www/system_advanced_notifications.php @@ -51,6 +51,12 @@ if($config['notifications']['smtp']['ipaddress']) $pconfig['smtpipaddress'] = $config['notifications']['smtp']['ipaddress']; if($config['notifications']['smtp']['notifyemailaddress']) $pconfig['smtpnotifyemailaddress'] = $config['notifications']['smtp']['notifyemailaddress']; +if($config['notifications']['smtp']['username']) + $pconfig['smtpusername'] = $config['notifications']['smtp']['username']; +if($config['notifications']['smtp']['password']) + $pconfig['smtppassword'] = $config['notifications']['smtp']['password']; +if($config['notifications']['smtp']['fromaddress']) + $pconfig['smtpfromaddress'] = $config['notifications']['smtp']['fromaddress']; if ($_POST) { @@ -79,12 +85,18 @@ if ($_POST) { // SMTP $config['notifications']['smtp']['ipaddress'] = $_POST['smtpipaddress']; $config['notifications']['smtp']['notifyemailaddress'] = $_POST['smtpnotifyemailaddress']; + $config['notifications']['smtp']['username'] = $_POST['smtpusername']; + $config['notifications']['smtp']['password'] = $_POST['smtppassword']; + $config['notifications']['smtp']['fromaddress'] = $_POST['smtpfromaddress']; write_config(); // Send test message via growl - register_via_growl(); - notify_via_growl("This is a test message form pfSense. It is safe to ignore this message."); + if($config['notifications']['growl']['ipaddress'] && + $config['notifications']['growl']['password'] = $_POST['password']) { + register_via_growl(); + notify_via_growl("This is a test message form pfSense. It is safe to ignore this message."); + } // Send test message via smtp if(file_exists("/var/db/notices_lastmsg.txt")) @@ -164,6 +176,13 @@ include("head.inc"); </td> </tr> <tr> + <td width="22%" valign="top" class="vncell">From e-mail address</td> + <td width="78%" class="vtable"> + <input name='smtpfromaddress' type='input' value='<?php echo $pconfig['smtpfromaddress']; ?>'><br/> + This is the e-mail address that will appear in the from field. + </td> + </tr> + <tr> <td width="22%" valign="top" class="vncell">Notification E-Mail address</td> <td width="78%" class="vtable"> <input name='smtpnotifyemailaddress' type='input' value='<?php echo $pconfig['smtpnotifyemailaddress']; ?>'><br/> @@ -171,6 +190,20 @@ include("head.inc"); </td> </tr> <tr> + <td width="22%" valign="top" class="vncell">Notification E-Mail auth username (optional)</td> + <td width="78%" class="vtable"> + <input name='smtpusername' type='input' value='<?php echo $pconfig['smtpusername']; ?>'><br/> + Enter the e-mail address username for SMTP authentication. + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Notification E-Mail auth password</td> + <td width="78%" class="vtable"> + <input name='smtppassword' type='password' value='<?php echo $pconfig['smtppassword']; ?>'><br/> + Enter the e-mail address password for SMTP authentication. + </td> + </tr> + <tr> <td valign="top" class=""> </td> |