# PHP mail form delivers email with empty content

**URL:** <https://forum.kirupa.com/t/php-mail-form-delivers-email-with-empty-content/288379>\
**Category:** programming\
**Created:** [May 14, 2009, 10:15pm UTC](https://forum.kirupa.com/t/php-mail-form-delivers-email-with-empty-content/288379 "2009-05-14T22:15:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flasherkirupa](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@flasherkirupa](https://forum.kirupa.com/u/flasherkirupa)\
**Post date:** [May 14, 2009, 10:15pm UTC](https://forum.kirupa.com/t/php-mail-form-delivers-email-with-empty-content/288379/1 "2009-05-14T22:15:49Z")

</div>

When I send a test message, all fields  
come empty. Can someone help me with this?

\<?php  
error\_reporting(0);

//define the destination recipient of all the incoming mails here  
$sendTo="user@yahoo.com";

$name=$\_POST[“name”];  
$email=$\_POST[“email”];  
$phone=$\_POST[“phone”];  
$subject=$\_POST[“subject”];  
$message=$\_POST[“message”];

$headers = “From: “”.$name.”" \<".$email."\>  
“;  
//$headers .= “To: \<”.$sendTo.”\>  
“;  
$headers .= “Reply-To: \<”.$email.”\>  
“;  
$headers .= “Return-Path: \<”.$email.”\>  
";  
$headers .= "MIME-Version: 1.0  
";  
$headers .= "Content-Type: text/HTML; charset=ISO-8859-1  
";

if($name==""){ echo “result=please type the name.”;$error=1;exit(); }  
if($email==""){ echo “result=please type the email.”;$error=1;exit(); }  
if($subject==""){ echo “result=please type the subject.”;$error=1;exit(); }  
if($message==""){ echo “result=please type the message.”;$error=1;exit(); }  
if($error)exit();

$ok=mail($sendTo, $subject, $message, $headers);  
if($ok)echo “result=message sent.”;else echo “result=message not sent.”;

?\>
