title: HTML Email mixed (html & attachement) coming thoough as plain text
body: <p>I've got an HTML email being sent by PHP, with a pdf attached via base64 encoding. It all works, except the email comes through as plain text, so you see all HTML tags and base64 output - obviously not ideal. There must be something I'm missing here to ensure it gets read as HTML &amp; attachment. </p>
  
  <p>If anybody can help that would be fantastic!</p>
  
  <p>My PHP:</p>
  
  <pre><code>&lt;?php $to = $email;
  
  $message = 'testing...';
  
  $subject = 'Health Insurance Quote Request';
  
  $headers = "From: Andy - CEO Health.com.au &lt;" . strip_tags('info@health.com.au') . "&gt;\r\n";
  $headers .= "Reply-To: Andy - CEO Health.com.au &lt;". strip_tags('info@health.com.au') . "&gt;\r\n";
  
  // boundary 
  $semi_rand = md5(time()); 
  $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; 
  
  // headers for attachment 
  $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; 
  
  // multipart boundary 
  $email_message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; 
  $email_message .= "--{$mime_boundary}\n";
  
  //get PDF URL
  $data = chunk_split(base64_encode(file_get_contents('http://example.com/doge.pdf')));
  
  $email_message .= "Content-Type: {\"application/pdf\"};\n" . " name=\"$product\"\n" . 
  "Content-Disposition: attachment;\n" . " filename=\"$product\"\n" . 
  "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
  $email_message .= "--{$mime_boundary}\n";
  
  mail($email, $subject, $email_message, $headers);
  </code></pre>
  
  <p>Example of output:</p>
  
  <pre><code>MIME-Version: 1.0
  Content-Type: multipart/mixed;
   boundary="==Multipart_Boundary_xc9c6c260d1e99ba11f86b40c6c7848e0x"
  
  This is a multi-part message in MIME format.
  
  --==Multipart_Boundary_xc9c6c260d1e99ba11f86b40c6c7848e0x
  Content-Type: text/html; charset="iso-8859-1"
  Content-Transfer-Encoding: 7bit
  
  testing...
  
  --==Multipart_Boundary_xc9c6c260d1e99ba11f86b40c6c7848e0x
  Content-Type: {"application/pdf"};
   name="HeartPlus65"
  Content-Disposition: attachment;
   filename="HeartPlus65"
  cwt/SGdVm9X6LXQwvq03c+afGdAA9NlSAk1G3NyG2S5pDSY+CycXKDnuBJ5gFRupvZva0H2CXQqA
  t9M6DlWx646bhhsx8NXdde0ES4z+8FP03XNEWTPMc/lWObbIG4ET4qxQ57eCm1V8RZOOzqG6+pu7
  mYERMqHobI26KpfZYx27x8ESi65xkqOYkdbFIJ1qm2HXUEGZC0B1Jr2c6qmHeo3VULGurdIKhERP
  Q6EJqtQ6rrWPbLiqzHgOlVLrfaIU8Zxe2SUhi4QTauK9G0/qbmjb2TD0HNkakoNlLbDzCql32d4A
  khPjiE9rBQZGOvRvtxnEaGAlXimw7Vp4tIsqkjkI2JQ1upHBRgTA31CjqPNBjdM9ISRKHl9MLvc0
  LeZUH8J7GNA1R+8mJvqkR0p5f7LZEbSkt7c2fopKX79LsEe2O7nv6qzJrc1xGreCsS
  
  ....
  </code></pre>