在生产中部署代码时,SMTP无法使用Code Igniter

时间:2014-05-23 16:05:11

标签: php codeigniter email ssl smtp

我使用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");但它没有投入生产。

1 个答案:

答案 0 :(得分:0)

Connection timed out表示它甚至无法连接到服务器。 如果这在开发中有效,但在生产中没有,那么在生产系统前面可能有一个防火墙来保护它,这会阻止访问。