Send an Email with a template using CodeIgniter


public function send_mail() {
 
$template = ‘discounts’;
 
$this->load->library( 'email' );
 
$this->email->from( 'example@gmail.com', 'Some Receiver' );
 
$this->email->to( 'example_email@gmail.com' );
 
$this->email->subject( ‘Message subject' );
 
$this->email->message( $this->load->view( ‘emailtemplates/’ . $template , $data, true ) );
 
$this->email->send();
 
}