From dd16aadff68508d3382c69aa432cdc8cb2988d22 Mon Sep 17 00:00:00 2001 From: jim-p Date: Thu, 13 Jun 2013 13:03:37 -0400 Subject: [PATCH] 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" --- usr/local/bin/mail.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 usr/local/bin/mail.php diff --git a/usr/local/bin/mail.php b/usr/local/bin/mail.php new file mode 100644 index 0000000000..a09f5c6476 --- /dev/null +++ b/usr/local/bin/mail.php @@ -0,0 +1,24 @@ +#!/usr/local/bin/php -q + "") { + $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