title: PHP mail() function,sending mail as HTML code
body: <p>I am facing a problem where when I send mail using <code>mail()</code>, it sends the HTML code in the mail. This is my code:</p>
  
  <pre><code>&lt;?php
  $message = "&lt;table width='100%' border='0' cellspacing='0' cellpadding='3'&gt;
    &lt;tr&gt;
      &lt;td colspan=2&gt;Dear ".$_POST['fname']."&amp;nbsp;".$_POST['lname'].",&lt;/td&gt;
    &lt;/tr&gt;
     &lt;tr&gt;
      &lt;td colspan=2&gt;Thank you for contacting us.We will get back to you in next 48 hrs.Your Contacts Details are as follows:&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td width='28%' &gt;Title&lt;/td&gt;
      &lt;td width='72%'&gt;".$_POST['title']."&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Email&lt;/td&gt;
      &lt;td&gt;".$_POST['email']."&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Your Message&lt;/td&gt;
      &lt;td&gt;".$_POST['message']."&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;How did you hear about us? &lt;/td&gt;
      &lt;td&gt;".$checkBox."&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  ";  
  
  $subject = "ContactUs";
  $headers .= "From: ".$from_mail." \r\n";
  $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  
  mail($_POST["coach"], $subject, $message, $headers);
  
  ?&gt;
  </code></pre>
  
  <p>And the output which I am getting in my e-mail looks like this:</p>
  
  <pre><code>&lt;table width='100%' border='0' cellspacing='0' cellpadding='3'&gt;
    &lt;tr&gt;
      &lt;td colspan=2&gt;Dear Test User,&lt;/td&gt;
    &lt;/tr&gt;
     &lt;tr&gt;
      &lt;td colspan=2&gt;Thank you for contacting us.Your Contacts Details are as follows:&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td width='28%' &gt;Title&lt;/td&gt;
      &lt;td width='72%'&gt;Mr.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Email&lt;/td&gt;
      &lt;td&gt;test@example.com&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Your Message&lt;/td&gt;
      &lt;td&gt;Test Message&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;How did you hear about us? &lt;/td&gt;
      &lt;td&gt;www.example.com&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I don't know why is this happening. Any suggestions will be appreciated.</p>