Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29755

Yii2 : Connection could not be established with host smtp.gmail.com [Connection refused #111] in a godaddy hosting

$
0
0

I'm trying to use Swift Mailer in Yii2.

My host is Godaddy and I'm trying to use a gmail account to send emails.

The code seems to be working fine, but when I try to use it I receive the error: Connection could not be established with host smtp.gmail.com [Connection refused #111]

I double-checked that I'm using the correct credentials for gmail. Could it be an issue with my host and if so, is there a way to fix it? This is the code

'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'transport' => [
                    'class' => 'Swift_SmtpTransport',
                    'host'=>'smtp.gmail.com',
                    'username'=>'myUserName@gmail.com',
                    'password'=>'******',
                    'port'=>'587',
                    'encryption'=>'tls',
                ],
            'useFileTransport' => false, //for the testing purpose, you need to enable this


        ],
I also tried with **`'class' => 'Swift_MailTransport',`**
but the error was not resolved.

The error is 

Connection could not be established with host smtp.gmail.com [Connection refused #111]

Please help me in this regard. Thanks,


Viewing all articles
Browse latest Browse all 29755

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>