Example #1
0
#!/usr/local/bin/php -q
<?php 
require_once "config.inc";
require_once "globals.inc";
require_once "notices.inc";
$options = getopt("s::");
if ($argc != 3) {
    echo "Usage: {$argv['0']} [subject] [message]\n";
    die;
}
send_smtp_message($argv[2], $argv[1]);
Example #2
0
#!/usr/local/bin/php-cgi -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);
}
        if ($_POST['disable_smtp'] == "yes") {
            $config['notifications']['smtp']['disable'] = true;
        } else {
            unset($config['notifications']['smtp']['disable']);
        }
        write_config();
        //write the changes to the config file
        pfSenseHeader("nmap-plugin-email-setup.php");
        return;
    }
    if ($_POST['test_smtp'] == gettext("Test Email")) {
        // Send test message via smtp
        if (file_exists("/var/db/notices_lastmsg.txt")) {
            unlink("/var/db/notices_lastmsg.txt");
        }
        send_smtp_message("This is a test email. If you received this email as directed, then this means that the NMap Plugin will successfully send NMap scan results.", "NMap Plugin: Test Email");
    }
}
$pgtitle = array(gettext("Services"), gettext("NMap-Plugin Email Setup"));
include "head.inc";
?>
	<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
		<?php 
include "fbegin.inc";
?>
		<form action="nmap-plugin-email-setup.php" method="post">
			<?php 
if ($input_errors) {
    print_input_errors($input_errors);
}
if ($savemsg) {