简体   繁体   English

在Codeigniter 2中发送电子邮件时出错

[英]Error Sending Email in Codeigniter 2

I am new in codeigniter framework. 我是codeigniter框架的新手。 I'm trying to send email but I have the problem: 我正在尝试发送电子邮件,但我遇到了问题:

Call to undefined method CI_Loader::libary() 调用未定义的方法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 . $this->load->libary键入错误。

It should be $this->load->library - there is a missing r in library word. 它应该是$this->load->library -有一个缺失rlibrary字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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