简体   繁体   中英

Error Sending Email in Codeigniter 2

I am new in codeigniter framework. I'm trying to send email but I have the problem:

Call to undefined method CI_Loader::libary()

here is my script on controller :

class Email extends CI_Controller{
function __construct()
{
    parent::__construct();
}

function index()
{
    $config = array(
        'protocol' => 'smtp',
        'smtp_host'=>'ss://smtp.googlemail.com',
        'smtp_port'=>465,
        'smtp_user'=>'thaitea.lumajang@gmail.com',
        'smtp_pass'=>'thaitealumajang1'
    );

    $this->load->libary('email', $config);
    $this->email->set_newline("\r\n");

    $this->email->from('thaitea.lumajang@gmail.com','Tri Wicaksono');
    $this->email->to('cha8agust@gmail.com');
    $this->email->subject('This is an email test');
    $this->email->message('It is working bro');

    if($this->email->send())
    {
        echo 'Your email send';
    } else {
        show_error($this->email->print_debbuger());
    }
}
}

I already find out the answer.

There is wrong typing in $this->load->libary .

It should be $this->load->library - there is a missing r in library word.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM