laravel5 and GoDaddy Exception when trying to send

2019-07-21 22:43发布

as the title says, when I'm trying to send a mail with Laravel 5 and with a shared host in GoDaddy I get the following error.

    Swift_TransportException in StreamBuffer.php line 265:
    Connection could not be established with host >localhost [php_network_getaddresses: 
    getaddrinfo failed: Name or service not known #0]

This is the configuration that I'm using:

'driver' => 'smtp',
'host' => 'localhost',
'port' => 587,
'from' => array('address' => 'mail@domain.com', 'name' => 'name'),
'encryption' => 'tls',
'username' => 'cpanel user name',
'password' => 'cpanel password',
'sendmail' => '/usr/lib/sendmail -t',
'pretend' => false,

As the support guy from GoDaddy told me, I use the host as "localhost" instead my domain name but still getting the exception.

Can anyone give me a hand with the correct configuration please?

1条回答
小情绪 Triste *
2楼-- · 2019-07-21 23:11

I had the same issue when I was using Godaddy web hosting and solved this by editing my .env file as,

MAIL_DRIVER=smtp
MAIL_HOST=XXXX.XXXX.in
MAIL_PORT=587
MAIL_USERNAME=dexxxxx
MAIL_PASSWORD=XXXXXXXX
MAIL_ENCRYPTION=tls

Where MAIL_HOST is your domain name from Godaddy, MAIL_USERNAME is your user name from Godaddy and MAIL_PASSWORD is your password from Godaddy.

I hope this may help you.

查看更多
登录 后发表回答