在实时服务器中发送带codeigniter类的电子邮件

时间:2017-07-05 02:25:52

标签: php codeigniter email

我在我的codeigniter中为我的Gmail发送测试消息时遇到了麻烦。显示没有错误,但是当我检查我的邮件时。空无一物。我已将邮件设置为允许应用程序的安全性较低,但仍未收到任何邮件。请帮帮我。

我也在使用hostgator作为我的域名

这是我来自控制器的代码:

function __construct() {
        parent:: __construct();
        $config = Array(
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_port' => 465,
            'smtp_user' => 'mymail@gmail.com',
            'smtp_pass' => 'xxxxxxxxx',
            'mailtype'  => 'html', 
            'charset'   => 'iso-8859-1'
        );
        $this->load->library('email',$config);

}

public function emailme() {
        $message = $this->input->post('email_msg');
        $this->email->from('mymail@gmail.com', 'John');//your mail address and name
        $this->email->to('mymailtest@gmail.com'); //receiver mail

        $this->email->subject('testing');
        $this->email->message($message);

        $this->email->send(); //sending mail
    }

0 个答案:

没有答案