What does this script do?
$message="Test Message";
$myaddress="foo@foo.bar.baz"; // use your address
$success=mail($myaddress, "Email Server Test", $message);
if ($success) {
echo "Mail sent!";
} else {
echo "Sending of mail failed...";
}
It's quite likely that the failure to send mail has nothing to do with your PHP script, and everything to do with the machine on which it runs...possibly it's your configuration, possibly it's restricted access to the SMTP server, etc.
What's the environment like?