【发布时间】:2016-12-06 21:09:28
【问题描述】:
我的日志文件显示此错误:
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());
}
有什么帮助吗?
【问题讨论】:
-
我将您的错误移到了问题的顶部。在深入研究代码之前了解一些上下文总是有帮助的。请参阅How to Ask 了解有关提出好问题的更多提示,并考虑为您正在尝试做的事情添加更多解释。我还更新了您的标题以包含您看到的实际错误消息。一个好的标题对于获得视图很重要。祝你好运!
标签: php codeigniter email libraries