2016-12-15 80 views
1

我已經從一臺服務器部署Yii2網站到godaddy。它顯示錯誤: -Yii2 smtp電子郵件不起作用godaddy

'If you receive error " Connection could not be established with host smtp.gmail.com [Connection refused #111] "' 

我設置下面的郵件CONFIGS: -

'mailer' => [ 
     'class' => 'yii\swiftmailer\Mailer', 
     'viewPath' => '@common/mail', 
     'transport' => [ 
      'class' => 'Swift_SmtpTransport', 
      'host' => 'smtp.gmail.com', 
      'username' => 't********[email protected]', 
      'password' => '***************', 
      'port' => '465', 
      'encryption' => 'tls', //depends if you need it 
     ], 
    ], 

回答

1

我解決它通過只評論運輸標籤如下: -

'mailer' => [ 
    'class' => 'yii\swiftmailer\Mailer', 
    'viewPath' => '@common/mail', 
    //'transport' => [ 
     // 'class' => 'Swift_SmtpTransport', 
     // 'host' => 'smtp.gmail.com', 
     // 'username' => 't********[email protected]', 
     // 'password' => '***************', 
     // 'port' => '465', 
     // 'encryption' => 'tls', //depends if you need it 
    // ], 
], 
+0

如何它甚至可以工作,如果發件人,主機,用戶密碼的東西在這裏評論? –

+0

不知道。但我認爲,因爲我們有PHP郵件(郵件())功能不需要任何憑據,那麼它也沒有要求它。 –