title: Send html and plain text email simultaneously with PHP Mailer
body: <p>I would like to send both html and plain text simultaneously in an email. I found <a href="http://kevinjmcmahon.net/articles/22/html-and-plain-text-multipart-email-/" rel="noreferrer">this pretty straightforward tutorial</a> but it used the mail() function to send the email.
  How do I transform this code send an email with the PHP Mailer class?</p>
  
  <pre><code>//specify the email address you are sending to, and the email subject
  $email = 'email@example.com';
  $subject = 'Email Subject';
  
  //create a boundary for the email. This 
  $boundary = uniqid('np');
  
  //headers - specify your from email address and name here
  //and specify the boundary for the email
  $headers = "MIME-Version: 1.0\r\n";
  $headers .= "From: Your Name \r\n";
  $headers .= "To: ".$email."\r\n";
  $headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n";
  
  //here is the content body
  $message = "This is a MIME encoded message.";
  $message .= "\r\n\r\n--" . $boundary . "\r\n";
  $message .= "Content-type: text/plain;charset=utf-8\r\n\r\n";
  
  //Plain text body
  $message .= "Hello,\nThis is a text email, the text/plain version.
  \n\nRegards,\nYour Name";
  $message .= "\r\n\r\n--" . $boundary . "\r\n";
  $message .= "Content-type: text/html;charset=utf-8\r\n\r\n";
  
  //Html body
  $message .= "
   Hello,
  This is a text email, the html version.
  
  Regards,
  Your Name";
  $message .= "\r\n\r\n--" . $boundary . "--";
  
  //invoke the PHP mail function
  mail('', $subject, $message, $headers);
  </code></pre>