如何检查我的smtp(gmail)代码是在codeigniter工作


How to check my smtp( for gmail ) code is working in codeigniter?

我正在使用smtp设置以codeigniter发送电子邮件

 //smtp settings  
        $config['protocol'] = 'smtp';
        $config['smtp_host'] = 'smtp.gmail.com';
        $config['smtp_port'] = 465;
        $config['smtp_user'] = '****@*****.***';
        $config['smtp_pass'] = '*****';
        $this->load->library('email', $config);
        $this->email->from('*****@*******.****', '******');
        $this->email->to('******@********.****');
        $this->email->subject('email subject ');
        $this->email->message("my email messages");
        if($this->email->send()){
            echo "done";
        }

我)我的的消息。

2)获得电子邮件接收方的电子邮件 ($ this ->电子邮件-> ('****@****.****'); )

但是我没有收到任何通知在我的smtp gmail帐户(收件箱/发送)。

如何确保smtp工作

在服务器的application/config/文件夹中创建email.php文件

地点:应用程序/配置/email.php

<?php
/*
* Protocol name TROFEO SOFTWARE SOLUTIONS
*/
$config['protocol'] = 'smtp';   
/*
* smtp_host name for mail sending.
* this 
*/
 //developers server name for smtp host
 $config['smtp_host'] = 'smtp.gmail.com';
//smtp port
 $config['smtp_port'] = 587;
//smtp user
$config['smtp_user'] = '******@***.**';
//smtp password
$config['smtp_pass'] = '************';
/*
*mail type send to user
*/
$config['mailtype']="html";
/*
* Character set of the mail
*/
$config['charset'] = 'iso-8859-1';
/*
*Wordwrap flag of the mail
*/
$config['wordwrap'] = TRUE;
/*
New line character
*/
$config['newline']= "'r'n";

然后在控制器

    $this->load->library('email');
    $this->email->from('*****@*******.****', '******');
    $this->email->to('******@********.****');
    $this->email->subject('email subject ');
    $this->email->message("my email messages");
    if($this->email->send()){
        echo "done";
    }