实施电子邮件CodeIgniter库时无法连接到ssl://smtp.googlemail.com:25 [英] Unable to connect to ssl://smtp.googlemail.com:25 while implementing email CodeIgniter lib

查看:143
本文介绍了实施电子邮件CodeIgniter库时无法连接到ssl://smtp.googlemail.com:25的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的日志文件显示此错误:

My log file shows this error:

ERROR - 2016-12-03 03:22:10 --> Severity: Warning --> fsockopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol E:\xampp\htdocs\verime_v11\system\libraries\Email.php 2014
ERROR - 2016-12-03 03:22:10 --> Severity: Warning --> fsockopen(): Failed to enable crypto E:\xampp\htdocs\verime_v11\system\libraries\Email.php 2014
ERROR - 2016-12-03 03:22:10 --> Severity: Warning --> fsockopen(): unable to connect to ssl://smtp.googlemail.com:25 (Unknown error) E:\xampp\htdocs\verime_v11\system\libraries\Email.php 2014

我的代码:

$subject      =    $this->input->post('subject');
$name     =    $this->input->post('name');
$email    =    $this->input->post('email');
$feedback  =    $this->input->post('feedback');
$created_date    =    date('Y-m-d');

$insertcontact_array = array(
   'subject'     => $subject,
   'name'        => $name,
   'email'       => $email,
   'feedback'    => $feedback,
   'created_date'=> $created_date,
); 

$config = array(
    'protocol'  => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => '25',
    'smtp_user' => 'firstn870@gmail.com',
    'smtp_pass' => 'developer'
);

$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from($email);
$this->email->to('firstn870@gmail.com');
$this->email->subject($subject);
$this->email->message($feedback);

if($this->email->send())
{
    $result = $this->db->insert('tblcontactus', $insertcontact_array);
    if(!empty($result))
    {
        return 1;
    }else
    {
        return 0;
    }
}else
{
    show_error($this->email->print_debugger());
}

有帮助吗?

推荐答案

将您的配置更改为:

$config = array(
    'protocol'  => 'smtp',
    'smtp_host' => 'smtp.googlemail.com',
    'smtp_port' => '587',
    'smtp_user' => 'firstn870@gmail.com',
    'smtp_pass' => 'developer'
);

注意:
1.删​​除ssl://
2.将端口从25更改为287

Note:
1. removed the ssl://
2. change port from 25 to 287

这篇关于实施电子邮件CodeIgniter库时无法连接到ssl://smtp.googlemail.com:25的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆