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\">";
}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.