我正在尝试从我的localhost向用户发送有关他们忘记密码的电子邮件。 (测试) 此功能在我的控制器中
// Send Request Email
public function send_email()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '***@gmail.com', // change it to yours
'smtp_pass' => '***', // change it to yours
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$message = '';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('***@gmail.com', "Mama");
$this->email->to('***@gmail.com');
$this->email->subject('Mama Needs You');
$this->email->message($message);
if($this->email->send())
{
echo 'Email sent to Mama.';
}
else
{
show_error($this->email->print_debugger());
}
}
用户输入电子邮件并单击请求按钮后,AJAX调用将请求上述功能(send_email)。但回复是这个
A PHP Error was encountered
严重性:警告
消息:fsockopen():SSL操作失败,代码为1. OpenSSL错误 消息:错误:14090086:SSL 例程:ssl3_get_server_certificate:证书验证失败
文件名:libraries / Email.php
行号:2055
回溯:
文件:D:\ xampp \ htdocs \ prototype \ application \ controllers \ Manage.php 行:191功能:发送
文件:D:\ xampp \ htdocs \ prototype \ index.php行:315功能: require_once
遇到严重错误:警告
消息:fsockopen():无法启用加密
文件名:libraries / Email.php
行号:2055
回溯:
文件:D:\ xampp \ htdocs \ prototype \ application \ controllers \ Manage.php 行:191功能:发送
文件:D:\ xampp \ htdocs \ prototype \ index.php行:315功能: require_once
遇到严重错误:警告
消息:fsockopen():无法连接 ssl://smtp.googlemail.com:465(未知错误)
文件名:libraries / Email.php
行号:2055
回溯:
文件:D:\ xampp \ htdocs \ prototype \ application \ controllers \ Manage.php 行:191功能:发送
文件:D:\ xampp \ htdocs \ prototype \ index.php行:315功能: require_once
答案 0 :(得分:0)
**试试这个**
public function index()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'smtp3.netcore.co.in',
'smtp_port' => 25,
'smtp_user' => 'support@9abusiness.com',
'smtp_pass' => 'Supp0rt',
'mailtype' => 'html',
'charset' => 'utf-8',
'wordwrap' => TRUE
);
$this->load->library('email',$config);
$this->email->from('support@9abusiness.com', 'Support');
$this->email->to('abdularbaaz@gmail.com');
$this->email->cc('');
$this->email->bcc('');
$this->email->subject('Test');
$this->email->message('This is a test email');
if ( ! $this->email->send())
{
// Generate error
echo "Email is not sent!!";
}
echo $this->email->print_debugger();
}
}