summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-06-13 13:03:37 -0400
committerjim-p <jimp@pfsense.org>2013-06-13 13:03:37 -0400
commit185f24c35ecdcb728f506401eae9bcd2a4a9cf50 (patch)
tree1f0e2e3236bbe86750ace62fa78f3d351e0f9d0b /usr
parent95dfe4f55c38be0bfc3401f2078fc30f2737adc9 (diff)
downloadpfsense-185f24c35ecdcb728f506401eae9bcd2a4a9cf50.zip
pfsense-185f24c35ecdcb728f506401eae9bcd2a4a9cf50.tar.gz
Add a simple CLI mail script capable of sending an SMTP message using echo/piped input, e.g. ifconfig -a | mail.php -s"ifconfig output"
Diffstat (limited to 'usr')
-rw-r--r--usr/local/bin/mail.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/usr/local/bin/mail.php b/usr/local/bin/mail.php
new file mode 100644
index 0000000..a09f5c6
--- /dev/null
+++ b/usr/local/bin/mail.php
@@ -0,0 +1,24 @@
+#!/usr/local/bin/php -q
+<?php
+require_once("config.inc");
+require_once("globals.inc");
+require_once("notices.inc");
+$options = getopt("s::");
+
+$message = "";
+
+if($options['s'] <> "") {
+ $subject = $options['s'];
+}
+
+
+$in = file("php://stdin");
+foreach($in as $line){
+ $message .= "$line";
+}
+
+if (!empty($subject))
+ send_smtp_message($message, $subject);
+else
+ send_smtp_message($message);
+?> \ No newline at end of file
OpenPOWER on IntegriCloud