title: PHP - Send HTML and plain Text email doesn't work in Gmail
body: <p>Could you explane me what is wrong in this simple code?<br>
  It doesn't work with Gmail but yes with some other clients.</p>
  
  <pre><code>$boundary = md5( uniqid() . microtime() );
  $to      =  $user;
  $headers[] = 'From: my@email.com';
  $headers[] = 'MIME-Version: 1.0';   
  $headers[] = 'Content-Type: multipart/alternative; boundary="'.$boundary.'"\r\n';
  $subject = "The subject";
  $message = "--" . $boundary . "\r\n";
  $message .= "Content-type: text/plain; charset=utf-8\r\n";
  $message .= "Content-Transfer-Encoding: 8bit\r\n\r\n"; 
  $message .= 'Simple Text Message line 1\r\nline 2\r\nline 3';
  $message .= "\r\n\r\n--" . $boundary . "\r\n";
  $message .= "Content-type: text/html; charset=utf-8\r\n";
  $message .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
  $message .= "&lt;h1&gt;html message!&lt;/h1&gt;";
  $message .= "\r\n\r\n--" . $boundary . "--";
  mail($to, $subject, $message, implode("\r\n", $headers))
  </code></pre>
  
  <p>In Gmail I get something like this:</p>
  
  <pre><code>--05fd97038918d12debb49153b3ad67a5
  Content-type: text/plain; charset=utf-8
  Content-Transfer-Encoding: 8bit
  
  Simple Text Message line 1\r\nline 2\r\nline 3
  
  --05fd97038918d12debb49153b3ad67a5
  Content-type: text/html; charset=utf-8
  Content-Transfer-Encoding: 8bit
  
  &lt;h1&gt;html message!&lt;/h1&gt;
  
  --05fd97038918d12debb49153b3ad67a5--
  </code></pre>