summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sysutils/pfSense-pkg-apcupsd/Makefile3
-rw-r--r--sysutils/pfSense-pkg-apcupsd/files/usr/local/pkg/apcupsd.xml6
-rwxr-xr-xsysutils/pfSense-pkg-apcupsd/files/usr/local/pkg/apcupsd_mail.php47
3 files changed, 11 insertions, 45 deletions
diff --git a/sysutils/pfSense-pkg-apcupsd/Makefile b/sysutils/pfSense-pkg-apcupsd/Makefile
index f8b2a02..ad23e19 100644
--- a/sysutils/pfSense-pkg-apcupsd/Makefile
+++ b/sysutils/pfSense-pkg-apcupsd/Makefile
@@ -12,8 +12,7 @@ COMMENT= pfSense package apcupsd
LICENSE= ESF
-RUN_DEPENDS= ${LOCALBASE}/sbin/apcupsd:sysutils/apcupsd \
- /etc/inc/phpmailer/PHPMailerAutoload.php:mail/pfSense-pkg-mailreport
+RUN_DEPENDS= ${LOCALBASE}/sbin/apcupsd:sysutils/apcupsd
NO_BUILD= yes
NO_MTREE= yes
diff --git a/sysutils/pfSense-pkg-apcupsd/files/usr/local/pkg/apcupsd.xml b/sysutils/pfSense-pkg-apcupsd/files/usr/local/pkg/apcupsd.xml
index e451a10..8f52f69 100644
--- a/sysutils/pfSense-pkg-apcupsd/files/usr/local/pkg/apcupsd.xml
+++ b/sysutils/pfSense-pkg-apcupsd/files/usr/local/pkg/apcupsd.xml
@@ -342,8 +342,8 @@
<description>
<![CDATA[
Choose how APCUpsd will send email notifications.<br /><br />
- <strong>phpMailer</strong> - In order to receive e-mail notifications through phpMailer, you need to configure SMTP Email Notifications on Advanced/Notifications section,&nbsp;
- and also install mailreport package.<br />
+ <strong>php</strong> - In order to receive e-mail notifications through php, you need to configure SMTP Email Notifications
+ on System/Advanced/Notifications section.<br />
<br />
<strong>SMTP built-in</strong> - A simple SMTP mail client for apcupsd. It does not have smtp authentication of any kind.
]]>
@@ -351,7 +351,7 @@
<type>select</type>
<default_value>phpmailer</default_value>
<options>
- <option><name>phpMailer</name><value>phpmailer</value></option>
+ <option><name>php</name><value>phpmailer</value></option>
<option><name>SMTP built-in</name><value>smtpbuiltin</value></option>
</options>
</field>
diff --git a/sysutils/pfSense-pkg-apcupsd/files/usr/local/pkg/apcupsd_mail.php b/sysutils/pfSense-pkg-apcupsd/files/usr/local/pkg/apcupsd_mail.php
index 17e18a9..0727ef0 100755
--- a/sysutils/pfSense-pkg-apcupsd/files/usr/local/pkg/apcupsd_mail.php
+++ b/sysutils/pfSense-pkg-apcupsd/files/usr/local/pkg/apcupsd_mail.php
@@ -29,7 +29,7 @@
*/
require_once("pkg-utils.inc");
require_once("globals.inc");
-require_once("phpmailer/PHPMailerAutoload.php");
+require_once("notices.inc");
global $config, $g;
@@ -53,49 +53,16 @@ if (empty($argv[1]) || empty($apcstatus["$argv[1]"])) {
return;
}
-$apcsubject = $apcstatus["$argv[1]"];
-
-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") {
- $mail->SMTPSecure = "ssl";
-}
-
-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']) {
- $mail->SMTPAuth = true;
- $mail->Username = $config['notifications']['smtp']['username'];
- $mail->Password = $config['notifications']['smtp']['password'];
-}
-
-$mail->ContentType = 'text/html';
-$mail->IsHTML(true);
-$mail->AddReplyTo($config['notifications']['smtp']['fromaddress'], "Apcupsd");
-$mail->SetFrom($config['notifications']['smtp']['fromaddress'], "Apcupsd");
-$address = $config['notifications']['smtp']['notifyemailaddress'];
-$mail->AddAddress($address, "Apcupsd Recipient");
-$mail->Subject = "{$config['system']['hostname']}.{$config['system']['domain']} - {$apcsubject}";
+$apcsubject = "apcupsd - " . $apcstatus["$argv[1]"];
+$apcmessage = "Status information from apcupsd:\n";
putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin");
-$mail->Body = "<pre>";
$ph = popen('apcaccess status 2>&1', "r" );
-while ($line = fgets($ph)) $mail->Body .= htmlspecialchars($line);
+while ($line = fgets($ph)) {
+ $apcmessage .= $line;
+}
pclose($ph);
-$mail->Body .= "</pre>";
-if (!$mail->Send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
-}
+send_smtp_message($apcmessage, $apcsubject);
?>
OpenPOWER on IntegriCloud