【发布时间】:2018-05-23 20:47:51
【问题描述】:
我正在开发 php 框架 codeigniter,电子邮件没有在本地主机上发送我还从我用来发送邮件的防病毒软件中删除了端口 465,并且还关闭了防病毒软件它给出了错误 " fsockopen(): SSL 操作失败,代码为 1", fsockopen():启用加密失败
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = '*******@gmail.com'; // change it to yours
$config['smtp_pass'] = '******'; // change it to yours
$config['charset' ] = 'iso-8859-1';
$config['newline' ] = "\r\n";
$config['mailtype' ] = 'text';
$config['validation' ] = TRUE;
$this->load->library('email',$config);
$this->email->from('*********@gmail.com');
$this->email->to('********@gmail.com');
$this->email->subject('Confirmation Email');
$this->email->message('Thank you');
if ($this->email->send())
{
echo "send successfully";
}
else
{
show_error($this->email->print_debugger());
}
这是我做的代码,你能解决这个问题吗?
【问题讨论】: