Well what could be missing would be the configuration of the email:
Example:
function sendEmail(){
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '7';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'contraseñagmail';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'text'; // o html
$config['validation'] = TRUE; // para validar el correo electronico
$this->email->initialize($config);
$this->email->from('[email protected]', 'myname');
$this->email->to('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
}
Important note the configurations can also be placed in an external file email.php in ./application/config/.
Example:
<?php
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '7';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'contraseñagmail';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'text'; // o html
$config['validation'] = TRUE; // para validar el correo electronico
>
Always substitute gmail username and password for the real ones of you ...