试图发送邮件时,laravel5和GoDaddy异常 [英] laravel5 and GoDaddy Exception when trying to send mail

查看:87
本文介绍了试图发送邮件时,laravel5和GoDaddy异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如标题所示,当我尝试使用Laravel 5和GoDaddy中的共享主机发送邮件时,出现以下错误.

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,

正如GoDaddy的支持人员告诉我的那样,我将主机用作"localhost"而不是我的域名,但仍然会出现异常.

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?

推荐答案

在使用Godaddy虚拟主机时,我遇到了同样的问题,并通过编辑.env文件来解决此问题,

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

其中MAIL_HOST是您来自Godaddy的域名,MAIL_USERNAME是您来自Godaddy的用户名,而MAIL_PASSWORD是您来自Godaddy的密码.

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.

希望这对您有所帮助.

这篇关于试图发送邮件时,laravel5和GoDaddy异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆