In this tutorial, I will describe how to send emails in a CodeIgniter application using SMTP. I will use the well known and maintained email sending class.
Code
$this->load->library('email');
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->to("example@gmail.com");
$this->email->from('demo@gmail.com');
$this->email->subject("Testing");
$this->email->message("Type your message");
$this->email->send();