aboutsummaryrefslogtreecommitdiffstats
path: root/config/sm.php
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-10-01 16:36:05 -0400
committerjim-p <jimp@pfsense.org>2013-10-01 16:36:30 -0400
commite9a1dee7011badfeb464c5b10d7721b42389858e (patch)
treeafe0750df54fab285feb7bea5c8deae52bcd1d36 /config/sm.php
parent237ff43cb71026b0a912ae772a0916e69b9bdedd (diff)
downloadpfsense-packages-e9a1dee7011badfeb464c5b10d7721b42389858e.tar.gz
pfsense-packages-e9a1dee7011badfeb464c5b10d7721b42389858e.tar.bz2
pfsense-packages-e9a1dee7011badfeb464c5b10d7721b42389858e.zip
Add e-mail capability to the arpwatch package. Only works on 2.1+
Diffstat (limited to 'config/sm.php')
-rw-r--r--config/sm.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/config/sm.php b/config/sm.php
new file mode 100644
index 00000000..e2c56fc4
--- /dev/null
+++ b/config/sm.php
@@ -0,0 +1,41 @@
+#!/usr/local/bin/php -q
+<?php
+require_once("config.inc");
+require_once("globals.inc");
+require_once("notices.inc");
+
+$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
+if (($pf_version < 2.1)) {
+ $error = "Sending e-mail on this version of pfSense is not supported. Please use pfSense 2.1 or later";
+ log_error($error);
+ echo "{$error}\n";
+ return;
+}
+
+$options = getopt("s::");
+
+$message = "";
+
+if($options['s'] <> "") {
+ $subject = $options['s'];
+}
+
+
+$in = file("php://stdin");
+foreach($in as $line){
+ if ( (substr($line, 0, 6) == "From: ")
+ || (substr($line, 0, 6) == "Date: ")
+ || (substr($line, 0, 4) == "To: "))
+ continue;
+ if (empty($subject) && (substr($line, 0, 9) == "Subject: ")) {
+ $subject = substr($line, 9);
+ continue;
+ }
+ $message .= "$line";
+}
+
+if (!empty($subject))
+ send_smtp_message($message, $subject);
+else
+ send_smtp_message($message);
+?> \ No newline at end of file