2010-04-28 42 views
4

部署後,我發現下面這個錯誤,當我嘗試發送郵件:在遠程主機:連接不能建立與主機smtp.gmail.com [連接超時#110]

500 |內部服務器錯誤| Swift_TransportException 連接無法與主機smtp.gmail.com建立[連接超時#110] 堆棧跟蹤

* 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('[email protected]', '[email protected]', 'Confirm Registration', 'Hello fjklsdjf,<br/><br/> <a href="http://www.tirengarfio.com/rs5/web/frontend_dev.php/register/confirm/m/19">Click here to confirm your registration</a><br/><br/> Your login information can be found below:<br/><br/> Username: fjklsdjf<br/> 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打開我的遠程主機。本地主機沒問題。

有什麼想法?

- 哈維

的Ubuntu 8.04

回答

3

我已採取直接從Gmail網站這些指令。

您必須在您的用戶名中使用@ gmail.com。

Outgoing Mail (SMTP) Server - requires TLS: smtp.gmail.com (use authentication) 
Use Authentication: Yes 
Use STARTTLS: Yes (some clients call this SSL) 
Port: 465 or 587 
Account Name: your full email address (including @gmail.com) 
Google Apps users, please enter [email protected]_domain.com 
Password: your Gmail password 
+0

謝謝,但它沒有工作.. – ziiweb 2010-04-28 18:51:59

+0

你可以在服務器上執行以下操作嗎? telnet smtp.gmail.com 465 也你爲什麼要死我-1?我給了一個有效的答案。 – 2010-04-29 17:45:18

+0

Hi @ChrisMuench,我正在使用Laravel 5.1並得到類似的問題。我已經在我的.env文件中跟蹤了你的輪廓,你能驗證嗎? drive = smtp,host = smtp.gmail.com,port = 587(也試過465),encryption = ssl(也試過tls),[email protected],password = secret,sendmail =/usr/sbin/sendmail -bs。這目前不工作,併產生:StreamBuffer.php中的Swift_TransportException行265: 無法與主機建立連接smtp.gmail.com – mtpultz 2015-06-23 00:31:20

0

我不知道這是否有幫助,購買我在本地計算機(Windows)上運行同樣的問題。爲了解決這個問題,我必須將php目錄中的兩個dll複製到system32(ssleay.dll和libeay.dll),並在我的apache配置上解開擴展php_openssl.dll。對於linux可能有類似的解決方案。我建議您聯繫主機,因爲您很可能無法在共享主機上執行此解決方案。

-1

如果你在沒有任何運氣的情況下得到這個,然後再次檢查設置。 我忽略了我的設置,後來發現主機錯了。

我用, smtp.google.com

,而不是 smtp.gmail.com

太傻,但它發生在我身上。

+0

**這不起作用!** – ihue 2015-11-10 12:39:01

3

您需要在防火牆

開465在CSF防火牆,你需要在TCP_OUT =

+1

你能告訴我們該怎麼做? – ihue 2015-06-03 16:11:24

0

孔加465,我有一個,而同樣的問題,替換:smtp.gmail.com173.194.65.108實際工作對我來說!

+0

得到錯誤的權利''連接不能建立主機173.194.65.108 [#0]' – ihue 2015-06-03 16:12:07

+0

**這是行不通的!** – ihue 2015-11-10 12:39:14

相關問題