diff options
author | Chris Buechler <cmb@pfsense.org> | 2015-08-16 00:09:38 -0500 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2015-08-16 00:09:38 -0500 |
commit | 1934e0aac8cde4954a3edc38bae3dc449583c2bf (patch) | |
tree | d1a8e57d9c2755582e41c980582b295915c4e842 /config/apcupsd/apcupsd_mail.php | |
parent | 809e29cad9be0b5bbd9afde0193ca628f92503ef (diff) | |
parent | 09b99e161868a7db26520858815456b88c96910c (diff) | |
download | pfsense-packages-1934e0aac8cde4954a3edc38bae3dc449583c2bf.tar.gz pfsense-packages-1934e0aac8cde4954a3edc38bae3dc449583c2bf.tar.bz2 pfsense-packages-1934e0aac8cde4954a3edc38bae3dc449583c2bf.zip |
Merge pull request #973 from doktornotor/patch-16
Diffstat (limited to 'config/apcupsd/apcupsd_mail.php')
-rwxr-xr-x | config/apcupsd/apcupsd_mail.php | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/config/apcupsd/apcupsd_mail.php b/config/apcupsd/apcupsd_mail.php index 15c74fd2..30a8b957 100755 --- a/config/apcupsd/apcupsd_mail.php +++ b/config/apcupsd/apcupsd_mail.php @@ -1,8 +1,9 @@ <?php /* apcupsd_mail.php - part of pfSense (https://www.pfsense.org/) - Copyright (C) 2014 Danilo G. Baio <dbaio@bsd.com.br> + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2014-2015 Danilo G. Baio <dbaio@bsd.com.br> + Copyright (C) 2015 ESF, LLC All rights reserved. Redistribution and use in source and binary forms, with or without @@ -26,7 +27,6 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - require_once("pkg-utils.inc"); require_once("globals.inc"); require_once("phpmailer/PHPMailerAutoload.php"); @@ -49,28 +49,31 @@ $apcstatus[emergency] = "Emergency Shutdown. Possible UPS battery failure"; $apcstatus[changeme] = "Emergency! UPS batteries have failed. Change them NOW"; $apcstatus[remotedown] = "Remote Shutdown. Beginning Shutdown Sequence"; -if (empty($argv[1]) || empty($apcstatus["$argv[1]"])) +if (empty($argv[1]) || empty($apcstatus["$argv[1]"])) { return; +} $apcsubject = $apcstatus["$argv[1]"]; -if (empty($config['notifications']['smtp']['ipaddress'])) +if (empty($config['notifications']['smtp']['ipaddress'])) { return; +} $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = $config['notifications']['smtp']['ipaddress']; -if ((isset($config['notifications']['smtp']['ssl']) && $config['notifications']['smtp']['ssl'] != "unchecked") || $config['notifications']['smtp']['ssl'] == "checked") +if ((isset($config['notifications']['smtp']['ssl']) && $config['notifications']['smtp']['ssl'] != "unchecked") || $config['notifications']['smtp']['ssl'] == "checked") { $mail->SMTPSecure = "ssl"; +} -if ((isset($config['notifications']['smtp']['tls']) && $config['notifications']['smtp']['tls'] != "unchecked") || $config['notifications']['smtp']['tls'] == "checked") +if ((isset($config['notifications']['smtp']['tls']) && $config['notifications']['smtp']['tls'] != "unchecked") || $config['notifications']['smtp']['tls'] == "checked") { $mail->SMTPSecure = "tls"; +} $mail->Port = empty($config['notifications']['smtp']['port']) ? 25 : $config['notifications']['smtp']['port']; -if($config['notifications']['smtp']['username'] && - $config['notifications']['smtp']['password']) { +if ($config['notifications']['smtp']['username'] && $config['notifications']['smtp']['password']) { $mail->SMTPAuth = true; $mail->Username = $config['notifications']['smtp']['username']; $mail->Password = $config['notifications']['smtp']['password']; @@ -91,7 +94,7 @@ while ($line = fgets($ph)) $mail->Body .= htmlspecialchars($line); pclose($ph); $mail->Body .= "</pre>"; -if(!$mail->Send()) { +if (!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } |