To send an email using PHP - CodeIgniter, first you have to load codeigniter email library using the following -
$this->load->library('email');
After loading email library, execute the following functions to set necessary elements to send an email. The from() function is used to set - from where the email is being sent ,and to() function is used - to whom the email is being sent. The subject() and message() function is used to set the subject and message of the email what we sent.
$this->email->from('your-email@sample.com', 'Your Name');
$this->email->to('someone-email@sample.com');
$this->email->subject('Codeigniter Email Test');
$this->email->message('Testing the Codeigniter email class.');
$this->email->send();