I have been trying to get a simple form that sends emails to work using the mail() function. I can't seem to get it to work. Is there something wrong with my code?
<?
echo "Attempting to send mail to: " . $ToName . " at " . $ToEmail ."<P>";
echo "From: " . $FromName . " at " . $FromEmail ."<P>";
echo "Subject: " . $Subject . "<P>";
echo "Message: " . "<BR>";
echo $Message;
mail($ToEmail, $Subject, $Message, "From: $FromEmail");
?>
This is my output when I test it, but I never get an email sent out:
Attempting to send mail to: Troy Broas at TroyNB@aol.com
From: Test Name at TroyBroas74@hotmail.com
Subject: Test Mail
Message:
This is a test email of the mail() function.
This is html form:
<HTML>
<HEAD></HEAD>
<BODY BGCOLOR=GRAY>
<FORM ACTION="mail.php" METHOD=post>
<font size=2 face=arial>
Recipient's Name : <BR><input type="text" name="ToName" size=40><P>
Recipient's Email Address : <BR><input type="text" name="ToEmail" size=40><P>
Sender's Name : <BR><input type="text" name="FromName" size=40><P>
Sender's Email Address : <BR><input type="text" name="FromEmail" size=40><P>
Subject : <BR><input type="text" name="Subject" size=40><P>
Message:<BR><TEXTAREA name=Message ROWS=10 COLS=40></TEXTAREA><P>
<input type="submit" value="Send Mail" >
<input type="reset" value="Clear Form" >
</FORM>
</HTML>
Is there something I'm doing wrong?