部署后,当我尝试发送邮件时,我在下面遇到此错误:
500 |内部服务器错误| Swift_TransportException无法使用主机smtp.gmail.com [连接超时#110]堆栈跟踪 Build 连接
* at ()
in SF_ROOT_DIR/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php line 235 ...
232. }
233. if (!$this->_stream = fsockopen($host, $this->_params['port'], $errno, $errstr, $timeout))
234. {
235. throw new Swift_TransportException(
236. 'Connection could not be established with host ' . $this->_params['host'] .
237. ' [' . $errstr . ' #' . $errno . ']'
238. );
* at Swift_Transport_StreamBuffer->_establishSocketConnection()
in SF_ROOT_DIR/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php line 70 ...
67. break;
68. case self::TYPE_SOCKET:
69. default:
70. $this->_establishSocketConnection();
71. break;
72. }
73. }
* at Swift_Transport_StreamBuffer->initialize(array('protocol' => 'ssl', 'host' => 'smtp.gmail.com', 'port' => 465, 'timeout' => 30, 'blocking' => 1, 'type' => 1))
in SF_ROOT_DIR/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php line 101 ...
98.
99. try
100. {
101. $this->_buffer->initialize($this->_getBufferParams());
102. }
103. catch (Swift_TransportException $e)
104. {
* at Swift_Transport_AbstractSmtpTransport->start()
in SF_ROOT_DIR/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Mailer.php line 74 ...
71.
72. if (!$this->_transport->isStarted())
73. {
74. $this->_transport->start();
75. }
76.
77. return $this->_transport->send($message, $failedRecipients);
* at Swift_Mailer->send(object('Swift_Message'), array())
in SF_ROOT_DIR/lib/vendor/symfony/lib/mailer/sfMailer.class.php line 300 ...
297. return $this->realtimeTransport->send($message, $failedRecipients);
298. }
299.
300. return parent::send($message, $failedRecipients);
301. }
302.
303. /**
* at sfMailer->send(object('Swift_Message'))
in SF_ROOT_DIR/lib/vendor/symfony/lib/mailer/sfMailer.class.php line 263 ...
260. */
261. public function composeAndSend($from, $to, $subject, $body)
262. {
263. return $this->send($this->compose($from, $to, $subject, $body));
264. }
265.
266. /**
* at sfMailer->composeAndSend('tirengar@gmail.com', 'tirengarfio@hotmail.com', 'Confirm Registration', 'Hello fjklsdjf,
<a href="http://www.tirengarfio.com/rs5/web/frontend_dev.php/register/confirm/m/19">Click here to confirm your registration</a>
Your login information can be found below:
Username: fjklsdjf
Password: m')
in SF_ROOT_DIR/plugins/sfDoctrineGuardExtraPlugin/modules/sfGuardRegister/lib/BasesfGuardRegisterActions.class.php line 89 ...
86. $user->getEmailAddress(),
87. 'Confirm Registration',
88. $message
89. );
90. }
91.
92. /**
* at BasesfGuardRegisterActions->sendRegisterConfirmMail(object('sfGuardUser'), 'm')
in SF_ROOT_DIR/plugins/sfDoctrineGuardExtraPlugin/modules/sfGuardRegister/lib/BasesfGuard
这是我在factories.yml中的配置 .
all:
mailer:
param:
delivery_strategy: realtime
transport:
class: Swift_SmtpTransport
param:
host: smtp.gmail.com
port: 465
encryption: ssl
username: tirengarfio
password: XXXX
端口465打开了我的远程主机 . localhost没问题 .
任何的想法?
- 哈维
Ubuntu 8.04
5 回答
你需要在防火墙上打开465
在CSF防火墙上,您需要在TCP_OUT =上添加465
好吧,我有一段时间同样的问题,取而代之的是:
smtp.gmail.com
与173.194.65.108
实际上为我工作!我直接从gmail网站上获取了这些说明 .
你必须在你的用户名中使用@ gmail.com .
我不知道这是否有帮助,买我在我的本地机器(Windows)上遇到同样的问题 . 为了解决这个问题,我不得不将php目录中的两个dll复制到system32(ssleay.dll和libeay.dll),并在我的apache配置中取消扩展php_openssl.dll . Linux可能有类似的解决方案 . 我建议你联系托管,因为你很可能无法在共享主机上执行此解决方案 .
如果你经常没有运气,那么再次检查设置 . 我忽略了我的设置,后来发现主机错了 .
我用了,
smtp.google.com
而不是
smtp.gmail.com
太傻了,但它发生在我身上 .