To send an email using PHP - CodeIgniter, first you have to load codeigniter email library using the following -
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('email@example.com', 'Your Name'); $this->email->to('firstname.lastname@example.org'); $this->email->subject('Codeigniter Email Test'); $this->email->message('Testing the Codeigniter email class.'); $this->email->send();