我在数字海洋Nginx和PHP 7上运行codeigniter3.03.当我尝试发送电子邮件时,我收到此错误:
@H_502_1@码:
@H_502_1@Severity: Warning@H_502_1@我的电子邮件设置是
Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Connection timed out)
Filename: libraries/Email.PHP
Line Number: 1986
$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'] = "\r\n"; $config['newline'] = "\r\n"; $config['bcc_batch_mode'] = FALSE; $config['bcc_batch_size'] = 200;@H_502_1@这个版本在PHP 5.x下的相同配置中运行完美. @H_502_1@在PHP.ini我有
extension=PHP_openssl.dll@H_502_1@启用. @H_502_1@我无法得到任何暗示,为什么这不应该在PHP7中工作.任何人都可以给我一个提示要检查的内容或这个错误的原因是什么.
你有没有试过smtp.googlemail.com?
@H_502_1@另请注意另一个答案,一个工作示例(例如在超时定义中似乎有所不同):
@H_502_1@> phpmailer send gmail smtp timeout
@H_502_1@另一种方案:
@H_502_1@> Having trouble with PHPMailer