article

Monday, March 24, 2014

How To Send Email With An Attachment In Codeigniter?

How To Send Email With An Attachment In Codeigniter?
$this->load->library('email');
$this->load->helper('path');

$this->email->from('your@example.com', 'Your Name');
$this->email->to('someone@example.com'); 
$this->email->cc('another@another-example.com'); 
$this->email->bcc('them@their-example.com'); 

$this->email->subject('Email Test');
$this->email->message('Testing the email class.'); 

/* This function will return a server path without symbolic links or relative directory structures. */
$path = set_realpath('uploads/pdf/');
$this->email->attach($path . 'yourfile.pdf');  /* Enables you to send an attachment */


$this->email->send();

echo $this->email->print_debugger();

Related Post