title: PHP mail function not setting from header correctly
body: <p>i have a php mail function which sends out emails with content from the contact form.but when i send this email on my website. instead of the from header being the email address entered, it is    username@srv30.000webhost.com and i don't know why.  my php mail function is below.</p>
  
  <p>$email is the email entered by the user.</p>
  
  <p>EDIT: 
  Subject: Comment from hello
  X-PHP-Script: kwp.host22.com/form_action.php for 78.147.187.64
  Message-Id: &lt;20131124204151.478EC28021@srv30.000webhost.com>
  Date: Sun, 24 Nov 2013 15:41:51 -0500 (EST)
  <strong>From: a5485011@srv30.000webhost.com</strong>
  Return-Path: a5485011@srv30.000webhost.com
  X-OriginalArrivalTime: 24 Nov 2013 20:41:52.0292 (UTC) FILETIME=[9B09B640:01CEE955]</p>
  
  <p>full php script:</p>
  
  <pre><code>$name = ($_GET['Name']) ? $_GET['Name'] : $_POST['Name'];
  $email = ($_GET['Email']) ?$_GET['Email'] : $_POST['Email'];
  $phone = ($_GET['Phone']) ?$_GET['Phone'] : $_POST['Phone'];
  $comment = ($_GET['Comment']) ?$_GET['Comment'] : $_POST['Comment'];
  
  // flag to indicate which method it uses. If POST set it to 1
  if ($_POST) $post=1;
  
  // Simple server side validation for POST data, of course, you should validate the email
  if (!$name) $errors[count($errors)] = 'Please enter your name.';
  if (!$email) $errors[count($errors)] = 'Please enter your email.'; 
  if (!$comment) $errors[count($errors)] = 'Please enter your comment.'; 
  
  // if the errors array is empty, send the mail
  if (!$errors) {
  
  // recipient
  $to = '&lt;example@example.com&gt;';  
  // sender
  $from = $name . ' &lt;' . $email . '&gt;';
  
  // subject and the html message
  $subject = 'Comment from ' . $name; 
  $message = '
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;table&gt;
      &lt;tr&gt;&lt;td&gt;Name&lt;/td&gt;&lt;td&gt;' . $name . '&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;Email&lt;/td&gt;&lt;td&gt;' . $email . '&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;Phone&lt;/td&gt;&lt;td&gt;' . $phone . '&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;Comment&lt;/td&gt;&lt;td&gt;' . nl2br($comment) . '&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;';
  
  // send the mail
  $result = @mail($to, $subject, $message, $from);
  
  // if POST was used, display the message straight away
  if ($_POST) {
      if ($result) echo 'Thank you! We have received your message.';
      else echo 'Sorry, unexpected error. Please try again later';
  
  // else if GET was used, return the boolean value so that 
  // ajax script can react accordingly
  // 1 means success, 0 means failed
  } else {
      echo $result;   }
  
  // if the errors array has values
  } else {
  // display the errors message
  for ($i=0; $i&lt;count($errors); $i++) echo $errors[$i] . '&lt;br/&gt;';
  echo '&lt;a href="contact.php"&gt;Back&lt;/a&gt;';
  
  exit;}
  function sendmail($to, $subject, $message, $from) {
  
  $headers = "MIME-Version: 1.0" . "\r\n";
  $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
  $headers .= 'From: ' . $email . "\r\n";
  $headers .= 'Reply-To: ' .$email . "\r\n";
  $headers .= 'X-Mailer: PHP/' . phpversion();
  @mail($to, $subject, $message, $headers); 
  
  if ($result) return 1;
  else return 0;}
  </code></pre>
  
  <p>im quite new to PHP so any help would be apreciated.
  thankyou</p>