It's likely that the mail() function is crapping out and that your mail installation is incorrect. Check your PHP.INI file and make sure you have one of these two setup:
If you are on a Windows server
[mail function]
SMTP = your.smtp.host
sendmail_from = you@yoursite.com
If you are on a Linux server
[mail function]
sendmail_path = /pathto/sendmail -t
sendmail_from = me@yoursite.com
After you got that setup, modify the code below and save the file as sendmsg.php:
<?php
if ($_POST['btnSubmit']) {
$to = "someone@somewhere.com";
$from = "From:you@yoursite.com";
$subject = "Hello";
$message = $_POST['message'];
if (mail($to, $subject, $message, $from)) {
echo "Your message was successfully sent.";
}
else {
echo "There was an error in sending your message";
}
}
else {
$strOut = "<form id='frmSendMail' name='frmSendMail' action='sendmsg.php' method='post'>";
$strOut .= "<textarea id='message name='message' cols='30' rows='5'></textarea>";
$strOut .= "<input type='submit' name='btnSubmit' value='Send Message' />";
$strOut .= "</form>";
echo $strOut;
}
?>