title: Sending HTML Email results in Email displaying HTML source (Codeigniter Email Class)
body: <p>I am having problems with email sent via the email class in Codeigniter displaying the source HTML code in the email message instead of the rendered HTML view. For testing, I am currently having CI on XAMPP on Windows, and using Gmail SMTP to send to the same gmail address.</p>
  
  <p>The function that sends the email is as follows:</p>
  
  <pre><code>$config = Array(
          'protocol' =&gt; 'smtp',
          'smtp_host' =&gt; 'ssl://smtp.googlemail.com',
          'smtp_port' =&gt; 465,
          'smtp_user' =&gt; 'myaccountname@gmail.com',
          'smtp_pass' =&gt; 'mygmailpassword',
          );
  
      $this-&gt;load-&gt;library('email', $config); 
      $this-&gt;email-&gt;from($this-&gt;config-&gt;item('webmaster_email', 'tank_auth'), $this-&gt;config-&gt;item('website_name', 'tank_auth'));
      $this-&gt;email-&gt;reply_to($this-&gt;config-&gt;item('webmaster_email', 'tank_auth'), $this-&gt;config-&gt;item('website_name', 'tank_auth'));
      $this-&gt;email-&gt;to($email);
      $this-&gt;email-&gt;subject(sprintf($this-&gt;lang-&gt;line('auth_subject_'.$type), $this-&gt;config-&gt;item('website_name', 'tank_auth')));
      $this-&gt;email-&gt;message($this-&gt;load-&gt;view('email/'.$type.'-html', $data, TRUE));
      $this-&gt;email-&gt;set_alt_message($this-&gt;load-&gt;view('email/'.$type.'-txt', $data, TRUE));
  
      $this-&gt;email-&gt;set_newline("\r\n"); // require this, otherwise sending via gmail times out
  
      $this-&gt;email-&gt;send();
  </code></pre>
  
  <p>There is no problem getting the text version sent. The view loaded is a html file that will be emailed out.</p>
  
  <pre><code>    &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;&lt;title&gt;Welcome to &lt;?php echo $site_name; ?&gt;!&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;div style="max-width: 800px; margin: 0; padding: 30px 0;"&gt;
  &lt;table width="80%" border="0" cellpadding="0" cellspacing="0"&gt;
  &lt;tr&gt;
  &lt;td width="5%"&gt;&lt;/td&gt;
  &lt;td align="left" width="95%" style="font: 13px/18px Arial, Helvetica, sans-serif;"&gt;
  &lt;h2 style="font: normal 20px/23px Arial, Helvetica, sans-serif; margin: 0; padding: 0 0 18px; color: black;"&gt;Welcome to &lt;?php echo $site_name; ?&gt;!&lt;/h2&gt;
  Thanks for joining &lt;?php echo $site_name; ?&gt;. We listed your sign in details below, make sure you keep them safe.&lt;br /&gt;
  To verify your email address, please follow this link:&lt;br /&gt;
  &lt;br /&gt;
  &lt;big style="font: 16px/18px Arial, Helvetica, sans-serif;"&gt;&lt;b&gt;&lt;a href="&lt;?php echo site_url('/auth/activate/'.$user_id.'/'.$new_email_key); ?&gt;" style="color: #3366cc;"&gt;Finish your registration...&lt;/a&gt;&lt;/b&gt;&lt;/big&gt;&lt;br /&gt;
  &lt;br /&gt;
  Link doesn't work? Copy the following link to your browser address bar:&lt;br /&gt;
  &lt;nobr&gt;&lt;a href="&lt;?php echo site_url('/auth/activate/'.$user_id.'/'.$new_email_key); ?&gt;" style="color: #3366cc;"&gt;&lt;?php echo site_url('/auth/activate/'.$user_id.'/'.$new_email_key); ?&gt;&lt;/a&gt;&lt;/nobr&gt;&lt;br /&gt;
  &lt;br /&gt;
  Please verify your email within &lt;?php echo $activation_period; ?&gt; hours, otherwise your registration will become invalid and you will have to register again.&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &lt;?php if (strlen($username) &gt; 0) { ?&gt;Your username: &lt;?php echo $username; ?&gt;&lt;br /&gt;&lt;?php } ?&gt;
  Your email address: &lt;?php echo $email; ?&gt;&lt;br /&gt;
  &lt;?php if (isset($password)) { /* ?&gt;Your password: &lt;?php echo $password; ?&gt;&lt;br /&gt;&lt;?php */ } ?&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  Have fun!&lt;br /&gt;
  The &lt;?php echo $site_name; ?&gt; Team
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any ideas how to get HTML emails sent to be rendered instead of displaying its source code?</p>