ION AUTH没有发送忘记密码的电子邮件

时间:2017-01-12 12:25:05

标签: php codeigniter ion-auth

配置文件:

$config['use_ci_email'] = TRUE; 
$config['email_config'] = array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => 'Myt E-mail Address',
    'smtp_pass' => 'My Correct Password',
    'mailtype' => 'html',
    'charset' => 'UTF-8'
);

库:

$this->email->set_newline("\r\n");

错误:

fsockopen(): Peer certificate CN=`l2.iserverplanet.net' did not match expected CN=`smtp.googlemail.com'
fsockopen(): Failed to enable crypto
fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Unknown error)

如何解决此错误及其出现的原因?请帮帮我。

1 个答案:

答案 0 :(得分:0)

$config = Array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => 'xxx',
    'smtp_pass' => 'xxx',
    'mailtype'  => 'html', 
    'charset'   => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");

// Set to, from, message, etc.

$result = $this->email->send();

还必须启用SSL:

extension=php_openssl.dll

来源:Sending email with gmail smtp with codeigniter email library