我使用smtp gmail创建了一个电子邮件。我的代码适用于开发,但是当我将其部署到生产环境时,它无法正常工作。
$config['smtp_host'] = "ssl://smtp.gmail.com";
A PHP Error was encountered
Severity: Warning
Message: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection timed out)
Filename: libraries/Email.php
Line Number: 1689
The following SMTP error was encountered: 110 Connection timed out
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error:
Unable to send data: MAIL FROM:
from:
The following SMTP error was encountered:
Unable to send data: RCPT TO:
to:
The following SMTP error was encountered:
Unable to send data: DATA
data:
之前我在开发时遇到过这个问题,修复只是为了添加这一行。
$this->email->set_newline("\r\n");
但它没有投入生产。
答案 0 :(得分:0)
Connection timed out
表示它甚至无法连接到服务器。
如果这在开发中有效,但在生产中没有,那么在生产系统前面可能有一个防火墙来保护它,这会阻止访问。