diff options
author | jim-p <jimp@pfsense.org> | 2013-06-13 13:03:37 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-06-13 13:05:14 -0400 |
commit | dd16aadff68508d3382c69aa432cdc8cb2988d22 (patch) | |
tree | a50196990f54a1e9e06d5fbbb5325e19619f3f40 /usr/local/bin | |
parent | 7c8451492f26e6131c07bdcca529598394ffc0e7 (diff) | |
download | pfsense-dd16aadff68508d3382c69aa432cdc8cb2988d22.zip pfsense-dd16aadff68508d3382c69aa432cdc8cb2988d22.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/local/bin')
-rw-r--r-- | usr/local/bin/mail.php | 24 |
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 |