PHP Mail Error "The Page at X Says: E-Mail can not be sent!"
I have a simple contact page set up with a form and I am sending those details via email using the php mail() function.
When I submit the page everything works fine and the email sends with all the data no problems.
However once it has done this I get a popup in the browser that says:
"The page at (address) says: E-mail can not be sent!"
even though this message is not true and the email sends fine I开发者_如何学运维 need to stop this from appearing as it halts my page's execution and no more code is ran after this. I can't seem to find anything about this error on google.
here is my mail code anyway just in case it is me causing it.
$headers = "From: ".$Email."\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$msg = '
<html>
<body>
<strong>Enquiry from www.mysite.com website</strong><br /><br />
<strong>Name:</strong> '.$FullName.' <br />
<strong>Email:</strong> '.$Email.' <br />
<strong>Phone:</strong> '.$Phone.' <br />
<strong>Message:</strong> '.$Message.' <br />
<strong>Group Size:</strong> '.$GroupSize.' <br />
<strong>Date From:</strong> '.$DayFrom.' '.$MonthFrom.' '.$YearFrom.' <br />
<strong>Date To:</strong> '.$DayTo.' '.$MonthTo.' '.$YearTo.' <br />
<strong>Meals Required:</strong> '.$MealsRequired.' <br />
<strong>Lift Pass Required:</strong> '.$LiftpassRequired.' <br />
<strong>Equipment Required:</strong> '.$SkiRequired.' <br />
</body>
</html>
';
mail($sendTo, $subject, $msg, $headers);
Cheers
It looks as if it's an error from another part of the page, probably JavaScript. I'd look through your JS to see if there is anything pertaining to your error there. The error LOOKS like part of the PHP, but PHP is server side, not client side, so cannot trigger errors.
If you have any JS that runs near or when the mail is sent, have a look through that for any errors it may be throwing up.
James
精彩评论