我在数字海洋Nginx和PHP 7上运行codeigniter3.03.当我尝试发送电子邮件时,我收到此错误:
码:
Severity: Warning
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;
这个版本在PHP 5.x下的相同配置中运行完美.
在PHP.ini我有
extension=PHP_openssl.dll
启用.
你有没有试过smtp.googlemail.com?
另请注意另一个答案,一个工作示例(例如在超时定义中似乎有所不同):
> phpmailer send gmail smtp timeout
另一种方案: