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 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常