title: Codeigniter email with attachment not working
body: <p>I have check similar links on stack overflow about this. But i'm unable to find any solution for this.</p>
  
  <p><strong>Link's i have checked</strong></p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/25416585/codeigniter-send-email-with-attach-file">Codeigniter send email with attach file</a></li>
  <li><a href="https://stackoverflow.com/questions/2383672/code-igniter-attach-email">Code Igniter -&gt; attach email</a></li>
  <li><a href="https://stackoverflow.com/questions/15693924/codeigniter-send-pdf-file-as-email-attachment">codeigniter send pdf file as email attachment</a></li>
  </ol>
  
  <p><strong>Problem</strong></p>
  
  <p>When is send mail, I gets the mail. with all details. but attachment is not working. </p>
  
  <p><strong>Try</strong></p>
  
  <p>I echo the file name, its prints the file name from controller</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>$upcon['upload_path'] = 'cv_uploads/';
  $upcon['max_size'] = '5120';
  $upcon['allowed_types'] = 'pdf|doc|txt|zip|rtf|docx';
  $this-&gt;load-&gt;library('upload', $upcon);
  if(!$this-&gt;upload-&gt;do_upload('file')){
      echo $this-&gt;upload-&gt;display_errors();
  }
  else{
      $up_data = $this-&gt;upload-&gt;data();
  
      $config['protocol'] = 'sendmail';
      $config['mailpath'] = '/usr/sbin/sendmail';
      $config['mailtype']  = 'html';
      $config['charset'] = 'iso-8859-1';
      $config['wordwrap'] = TRUE;
  
      $this-&gt;load-&gt;library('email',$config);
      $this-&gt;email-&gt;set_newline("\r\n");
  
      $name = $this-&gt;input-&gt;post('name');
      $email = $this-&gt;input-&gt;post('email');
      $address = $this-&gt;input-&gt;post('address');
      $residence = $this-&gt;input-&gt;post('residence');
      $office = $this-&gt;input-&gt;post('office');
      $mobile = $this-&gt;input-&gt;post('mobile');
      $position = $this-&gt;input-&gt;post('position');
      $comment = $this-&gt;input-&gt;post('comment');
  
      $file_name= '/cv_uploads/'.$up_data['file_name'];
  
      $this-&gt;email-&gt;from('xx@xxx.com', 'site name'); 
      $this-&gt;email-&gt;to('yy@yyyy.com');
      $this-&gt;email-&gt;attach($file_name);
      $this-&gt;email-&gt;subject('Subject');
      $this-&gt;email-&gt;message("Message ");
      if(!$this-&gt;email-&gt;send())
      {
          $data['sent_mail'] = false;
      }
      else{
          $data['sent_mail'] = "true";
      }
  
      print_r($file_name);
  }
  </code></pre>
  
  <blockquote>
    <p>I'm receiving mail without the attachment. Any idea??</p>
  </blockquote>