title: Gmail displaying email messages with html codes
body: <p>I have a little piece of code for sending email messages that can cater html codes. The message displays perfectly in hotmail, however in gmail, all the html codes were just regarded as text and displayed.</p>
  
  <p>Below is the code format:-</p>
  
  <pre><code>$headers        = "From: $from \r\n &lt;$email_return&gt;"; 
  $headers        .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
  
  ob_get_contents(); ?&gt; 
  --PHP-mixed-&lt;?php echo $random_hash; ?&gt;  
  Content-Type: multipart/alternative; boundary="PHP-alt-&lt;?php echo $random_hash; ?&gt;" 
  
  --PHP-alt-&lt;?php echo $random_hash; ?&gt;  
  Content-Type: text/plain; charset="utf-8" 
  Content-Transfer-Encoding: 7bit
  
  &lt;?php echo $email_message;?&gt;
  
  --PHP-alt-&lt;?php echo $random_hash; ?&gt;  
  Content-Type: text/html; charset="utf-8" 
  Content-Transfer-Encoding: 7bit
  
  &lt;div style="text-align:left;"&gt;&lt;img src="sitelogo.png" height="50px;"&gt;&lt;/div&gt;
  &lt;br&gt;
  Dear &lt;?php echo $name;?&gt;,
  &lt;br&gt;&lt;br&gt;
  Thanks!
  
  &lt;br&gt;&lt;br&gt;&lt;br&gt;
  &lt;strong&gt;&lt;i&gt;&lt;?php echo $email_signature;?&gt;&lt;/i&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
  
  --PHP-alt-&lt;?php echo $random_hash; ?&gt;-- 
  
  &lt;?php 
  $message = ob_get_clean(); 
  $mail_sent = mail($to, $subject, $message, $headers); 
  echo $mail_sent ? "OK!!" : "not OK!!";
  }
  ?&gt;
  </code></pre>
  
  <p>I wonder if I can do anything to the php codes for proper display, otherwise I may have to give up the html format. Thank you.</p>