Skip to main content
Help Center
The GoDaddy Community will undergo maintenance starting on Tuesday, August 3rd at 3pm PST / 6pm EST. Learn more
Showing results for 
Show  only  | Search instead for 
Did you mean: 

php mail() not working with Linux cPanel

I have a contact form on my website contact page with the following code

$name = $_POST['name'];
$mob = $_POST['mob'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "myemail";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You for contacting mywebsite ! <br> We will get back to you shortly.";


I am receiving blank emails only, without any content and details.

Godaddy customer service guys are giving parroted scripts only. 

Please help ASAP. 

Super User IV



I believe you need to split out the variables out side the quotes and join it with .

So it would be 

$formcontent="From: ". $name . "\n Message: " . $message;

Here is example that shows this as well -

You would need this for your header as well


I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community