title: Codeigniter send email with attach file
body: <p>I am trying to send email on codeigniter with attach file.</p>
  
  <p>I always receive email successfully. However , I never receive with attach file. Below is code and highly appreciate for all comments.</p>
  
  <pre><code>    $ci = get_instance();
      $ci-&gt;load-&gt;library('email');
      $config['protocol'] = "smtp";
      $config['smtp_host'] = "ssl://smtp.gmail.com";
      $config['smtp_port'] = "465";
      $config['smtp_user'] = "test@gmail.com";
      $config['smtp_pass'] = "test";
      $config['charset'] = "utf-8";
      $config['mailtype'] = "html";
      $config['newline'] = "\r\n";
  
      $ci-&gt;email-&gt;initialize($config);
  
      $ci-&gt;email-&gt;from('test@test.com', 'Test Email');
      $list = array('test2@gmail.com');
      $ci-&gt;email-&gt;to($list);
      $this-&gt;email-&gt;reply_to('my-email@gmail.com', 'Explendid Videos');
      $ci-&gt;email-&gt;subject('This is an email test');
      $ci-&gt;email-&gt;message('It is working. Great!');
  
      $ci-&gt;email-&gt;attach( '/test/myfile.pdf');
      $ci-&gt;email-&gt;send();
  </code></pre>