douwei1944 2016-02-22 19:35
浏览 303

升级到php 7后出现fsockopen错误

I run codeigniter3.03 on digital ocean nginx and php 7. When I try to send an email I get this error:

Code:

Severity: Warning Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Connection timed out) Filename: libraries/Email.php Line Number: 1986

My email setup is

$config['useragent'] = 'CodeIgniter';
$config['protocol'] = 'smtp';
//$config['mailpath'] = '/usr/sbin/sendmail';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_user'] = 'xxxxxx@gmail.com';
$config['smtp_pass'] = 'xxxxxxxxxxxx';
$config['smtp_port'] = 465; 
$config['smtp_timeout'] = 5;
$config['wordwrap'] = TRUE;
$config['wrapchars'] = 76;
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['validate'] = FALSE;
$config['priority'] = 3;
$config['crlf'] = "
";
$config['newline'] = "
";
$config['bcc_batch_mode'] = FALSE;
$config['bcc_batch_size'] = 200;

This version runs flawlessly in the same config under php 5.x.

in php.ini i have

 extension=php_openssl.dll

enabled.

I could not get any hint anywhere why this should not work in php7. Can anybody give me a hint what to check or what the cause of this error could be.

  • 写回答

1条回答 默认 最新

  • duanbi3786 2016-05-26 15:31
    关注

    Did you try smtp.googlemail.com already?

    Also note this other answer, with a working example (seems to be different, for instance in the timeout definition):

    Another solution:

    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制