Split actual SMTP send into its own function.
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"