You can use the following code saved into a file with a .php extension to test PHP mail functionality:
<?
$headers = 'From: webmaster@example.com';
mail('nobody@example.com', 'Test email using PHP', 'This is a test email message', $headers, '-fwebmaster@example.com');
?>
<?php
$to = 'nobody@example.com';
$subject = 'Test email using PHP';
$message = 'This is a test email message';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers, '-fwebmaster@example.com');
?>© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

6 Comments
issue with: $email = $_POST['email'];
<?php
$to = 'nobody@example.com';
$subject = 'Test email using PHP';
$email = $_POST['email'];
$message = 'This is a test email message $email';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
re: POST
Headers required in RS environment!
Use Test Mail Server tool :
Add new comment