title: Not able to send a view/template through email in codeigniter
body: <p>i have a codeigniter project through which i wish to send emails to the user.I wish to send the templates having html code effect, however inside the email i am getting html code, instead of view. Can anyone please tell how to do so</p>
  
  <p>Code that i am using is</p>
  
  <p>View</p>
  
  <pre><code>&lt;?php echo form_open('home/forgot_pass'); ?&gt;
      &lt;div class="form-group"&gt;
          &lt;?php
              $data = array(
                  'type'=&gt;'text', 
                  'class' =&gt; "form-control",
                  'name'=&gt;'email',
                  'autocomplete'=&gt;'off', 
                  'placeholder'=&gt;'Email' 
                  );
              ?&gt;
          &lt;?php echo form_input($data); ?&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;?php
              $data = array(
                  'type'=&gt;'submit',
                  'class'=&gt;'btn btn-success btn-block',
                  'name'=&gt;'submit',
                  'content'=&gt;'Login'
              );
  
              echo form_button($data); 
          ?&gt;
      &lt;/div&gt;
  &lt;?php echo form_close(); ?&gt;
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>public function forgot_pass()
      {
          $this-&gt;user_model-&gt;forgot_pass();
  
      }
  </code></pre>
  
  <p>Model</p>
  
  <pre><code>public function forgot_pass()
      {
          $email = $this-&gt;input-&gt;post('email');
          $this-&gt;db-&gt;where('email',$email);
          $query = $this-&gt;db-&gt;get('users');
          $result = $query-&gt;row();
  
          if($result)
              {
                  $password = $result-&gt;password;
  
                  $from_email = "xyz@gmail.com"; 
  
                  $this-&gt;load-&gt;library('email'); 
  
                  $this-&gt;email-&gt;from($from_email, 'ABC');
                  $data = array(
                  'password'=&gt; $password
                  );
  
                  $this-&gt;email-&gt;to($email); 
                  $this-&gt;email-&gt;subject('Forgot Password');  
  
                  $body = $this-&gt;load-&gt;view('users/forgot_password_email',$data,TRUE);
                  $this-&gt;email-&gt;message($body);   
                  $this-&gt;email-&gt;send(); 
  
              }
  
      }
  </code></pre>
  
  <p>Can anyone tell how to send template in email through codeigniter</p>
  
  <p>forgot_password_email view</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  
  &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;nav class="navbar navbar-inverse navbar-fixed-top" role="navigation" style="padding: 8px;"&gt;
  
          &lt;span style="color:white;text-align:center;margin-left: 45%;font-size: 20px;font-weight: 600;"&gt;LITEHIRES&lt;/span&gt;
  
      &lt;/nav&gt;
  
      &lt;div class="container" style="margin-left: 25%; margin-top: 4%;"&gt;
          &lt;p style="font-weight: 600; font-size: 18px;"&gt;Hi Samya&lt;/p&gt;
  
              &lt;p&gt; You have recently requested for a password on your litehires account. Please use the following password for your account&lt;/p&gt;
              &lt;p style=" margin-left: 25%; color: #3498db; font-size: 16px; "&gt;&lt;?php echo $password; ?&gt;&lt;/p&gt;
  
              &lt;p&gt;Thanks&lt;/p&gt;
              &lt;p style=" margin-top: -10px; "&gt;Litehires Team&lt;/p&gt;
  
      &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>