Jump to content

[SOLVED] Error - Bad parameters with PHP Mail funtion - please help


fatmikey

Recommended Posts

I switched web hosting companies and my mail statement worked fine with the old company but with the new company I keep getting this error:

 

Warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. in /home/content/h/e/w/hewittm/html/registration.php on line 171

 

Here is my code, any suggestions would be greatly appreciated:

 

if (mail($To, $Subject, $Body, $Headers)) {
   print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou.htm\">";
   } else {
   print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}

Try removing the headers all together and add them in line by line to find your problem. My guess is your hosting company doesn't allow a From header that is outside of your domain. This is becoming more and more common among hosting services as a security measure

Along those same lines, the From: address should always be a mail box hosted at the sending mail server and you should use the Reply-to: address for any user entered email address.

 

Give this a try for your header separators (which are \r\n now) -

Note: If messages are not received, try using a LF (\n) only. Some poor quality Unix mail transfer agents replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with » RFC 2822.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.