This is my script I use to check php installations. You need to set your email address and IP address before uploading and using the script. If successful, you'll see an "ok" on the page and the email address specified will receive an email. If you receive an "ok" but no mail, check how your PHP mail setup.
<?php
/*
* php test script
*
*/
// ********* SETTINGS ****************
// email address to receive the test email
$to = 'you@yourdomain.com';
// ip addresses allowed to run this script
// set any LAN and Internet IPs to allow use on all
$allow = array('1.2.3.4','192.168.0.1');
// ******* END SETTINGS ******************
$commands = array(
'mail' => 'Mail',
'info' => 'phpinfo()',
);
$regexp = '#^('.str_replace('.','\\.',join('|',$allow)).')$#';
$msg = '';
$cmd = $_REQUEST['test'];
if (!preg_match('#\W#',$cmd) && isset($commands[$cmd])) {
if (preg_match($regexp,$_SERVER['REMOTE_ADDR'])) {
switch ($cmd) {
case 'mail' :
$subject = 'Mail Test Script';
$body = 'Mail Sent - '.date('r');
$ok = mail($to,$subject,$body);
$msg = $ok ? 'mail sent successfully' : 'mail send failed';
break;
case 'info' :
phpinfo();
exit;
default :
$cmd = '';
$msg = 'unrecognised command';
}
} else {
$msg = 'you aren\'t authorised to use this function';
}
} else {
$cmd = '';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<title>PHP Test Script</title>
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
/*]]>*/-->
</style>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
//--><!]]>
</script>
</head>
<body>
<h1>Test Script</h1>
<ul>
<?php foreach ($commands as $cmd => $prompt) { ?>
<li><a href="?test=<?php echo $cmd; ?>"><?php echo $prompt; ?></a></li>
<?php } ?>
</ul>
<h2>Previous Command Results : <?php echo $cmd; ?></h2>
<p><?php echo $msg; ?> </p>
</body>
</html>