我在 Digital Ocean Ubuntu 12.04.5 LTS (GNU / Linux 3.2.0-24-virtual i686)上使用 Symfony2 。 一切正在我的本地主机上,但不适用于Digital Ocean Server , 当我尝试在启用激活电子邮件的网站中注册用户时出现错误消息:
Connection could not be established with host smtp.gmail.com [Connection timed out #110]
500 Internal Server Error - Swift_TransportException
和错误堆栈跟踪:
$this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, stream_context_create($options));
if (false === $this->_stream) {
throw new Swift_TransportException(
'Connection could not be established with host '.$this->_params['host'].
' ['.$errstr.' #'.$errno.']'
);
服务器终端的输出:
yusuf@xwzxc:~$ telnet smtp.gmail.com 465
Trying 74.125.130.108...
Trying 74.125.130.109...
Trying 2404:6800:4003:c01::6c...
telnet: Unable to connect to remote host: Network is unreachable
任何帮助将不胜感激。
感谢
答案 0 :(得分:2)
为了抑制垃圾邮件和滥用行为,DigitalOcean的某些新用户帐户默认会阻止其SMTP端口。不幸的是,有时会出现误报。听起来这可能是你的情况。如果您打开support ticket,团队会很乐意为您删除该块
答案 1 :(得分:0)
作为临时解决方案,我已经通过IP更改了smtp.gmail.com
您可以通过命令行上的ping smtp.gmail.com
获取IP。