<?php

error_reporting (E_ALL ^ E_NOTICE);

$from    = $_GET['from'];//$GLOBALS["HTTP_GET_VARS"]["from"];
$to      = $_GET['to'];//$GLOBALS["HTTP_GET_VARS"]["to"];
$mode    = $_GET['mode']; //$GLOBALS["HTTP_GET_VARS"]["mode"];
$subject = $_GET['subject'];//$GLOBALS["HTTP_GET_VARS"]["subject"];

if ($to=="") exit;
if ($from=="") $from="webmaster@".$HTTP_SERVER_VARS["SERVER_NAME"];

echo "From: $from <br>";
echo "To: $to <br>";

if ($mode == "") {

	$result=mail(
		$to,
		"Standard mail test", 
		"Test message body",
		"From: $from\r\n" ."Reply-To: test@test.com\r\n"."X-Mailer: PHP/" . phpversion()
	);

	if($result) echo "Mail sent"; else echo "Mail NOT sent";

} elseif ($mode == "fkey") {

	$result=mail($to, "$subject Test -f parameter", "Test mail with -f sendmail option", "From: $from", "-f$from");

	if($result) echo "Mail with -f sendmail parameter sent";
	else echo "Mail with -f sendmail parameter NOT sent";

} elseif ($mode == "simple") {

	$result=mail($to, "Test simple mail", "Simple mail body");

	if($result) echo "Simple mail sent"; else echo "Simple mail NOT sent";

}

?>
