I have a library in CodeIgniter called \"someclass\".
class someclass extends CI_Controller {
function __construct() {
parent::__construct();
You can have 2 situations in my vision.
Here, you can create a method called sendEmail
function sendEmail($naar=0,$onderwerp=0,$bericht=0)
{
$CI =& get_instance();
$CI->load->library('email');
//or autoload it from /application/config/autoload.php
$CI->email->from('tester@test.com', 'test');
$CI->email->to($to);
$CI->email->subject($onderwerp);
$CI->email->message("Test
bericht :
".$bericht);
$CI->email->send();
}
Load your custom library in your controller and call id with sendEmail(....)
You can extend native email library class and create a method inside that class called sendEmail for example:
class MY_Email extends CI_Email { public function _construct() { parent::_construct(); } public function sendEmail () ..... etc. }
From your controller load native library class, use $this->load->library('email')
and send your email by calling $this->email->sendEmail(...)