Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从gmail发送带有CodeIgniter email()库的邮件(在本地主机中)不起作用_Php_Codeigniter_Email_Smtp - Fatal编程技术网

Php 从gmail发送带有CodeIgniter email()库的邮件(在本地主机中)不起作用

Php 从gmail发送带有CodeIgniter email()库的邮件(在本地主机中)不起作用,php,codeigniter,email,smtp,Php,Codeigniter,Email,Smtp,我已将codeIgniter电子邮件设置为从我的Google帐户发送电子邮件,但它会出错。它不工作,它说它无法连接到服务器,或者服务器方没有响应 我在php.ini中启用了未注释的这些扩展: extension=php_sockets.dll extension=php_openssl.dll 以下是我的CI配置: $configs = array( 'protocol'=>'smtp', 'smtp_host'=>'ssl://smtp.gmail

我已将codeIgniter电子邮件设置为从我的Google帐户发送电子邮件,但它会出错。它不工作,它说它无法连接到服务器,或者服务器方没有响应

我在php.ini中启用了未注释的这些扩展:

extension=php_sockets.dll
extension=php_openssl.dll
以下是我的CI配置:

$configs = array(
        'protocol'=>'smtp',
        'smtp_host'=>'ssl://smtp.gmail.com',
        'smtp_user'=>'cgmaster.iran@gmail.com',
        'smtp_pass'=>"PASSWORD",
        'smtp_port'=>'456'
        );
        $this->load->library("email", $configs);
        $this->email->set_newline("\r\n");
        $this->email->to("mostafatalebi@rocketmail.com");
        $this->email->from("cgmaster.iran@gmail.com", "Mostafa Talebi");
        $this->email->subject("This is bloody amazing.");
        $this->email->message("Body of the Message");
        if($this->email->send())
        {
            echo "Done!";   
        }
        else
        {
            echo $this->email->print_debugger();    
        }
这是我得到的第一行错误:

The following SMTP error was encountered: 10060 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. 

您使用的是什么版本的CI?如果是2.1.4,那么配置数组中存在差异。试试这个:

$configs = array(
    'protocol'  =>  'smtp',
    'smtp_host' =>  'ssl://smtp.gmail.com',
    'smtp_user' =>  'cgmaster.iran@gmail.com',
    'smtp_pass' =>  'PASSWORD',
    'smtp_port' =>  '465'
);

您使用的是什么版本的CI?如果是2.1.4,那么配置数组中存在差异。试试这个:

$configs = array(
    'protocol'  =>  'smtp',
    'smtp_host' =>  'ssl://smtp.gmail.com',
    'smtp_user' =>  'cgmaster.iran@gmail.com',
    'smtp_pass' =>  'PASSWORD',
    'smtp_port' =>  '465'
);

你的gmail smtp端口错误,配置键不是“smtp\u密码”是“smtp\u密码”我想你已经更新了你的问题并修复了后者你的gmail smtp端口错误,配置键不是“smtp\u密码”是“smtp\u密码”我想你已经更新了你的问题并修复了后者