2016-12-15 2 views
1

Ich habe eine Yii2-Website von einem Server auf godaddy bereitstellen. Seine zeigt einen Fehler: -Yii2 smtp E-Mail funktioniert nicht auf godaddy

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

ich die Mail configs unten eingestellt haben: -

'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 
     ], 
    ], 

Antwort

1

ich gelöst es nur um den Transport-Tag kommentiert wie folgt: -

'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

Wie funktioniert Es funktioniert sogar, wenn Absender, Host, Benutzer-Passwort Zeug hier kommentiert ist? –

+0

Weiß nicht. Aber ich denke, da wir php mail (mail()) Funktion brauchen keine Anmeldeinformationen, dann muss es auch nicht danach fragen. –