Php Can';t使用Laravel 5.0.33发送电子邮件
我尝试使用以下代码发送电子邮件:Php Can';t使用Laravel 5.0.33发送电子邮件,php,email,laravel,phpmailer,Php,Email,Laravel,Phpmailer,我尝试使用以下代码发送电子邮件: 'driver' => 'smtp', 'host' => 'a2plcpnl0296.prod.iad2.secureserver.net;a2plcpnl0296.prod.iad2.secureserver.net', 'port' => 587, 'from' => ['address' => 'contact@theventuregame.com', 'name' => 'The Venture Game TM'],
'driver' => 'smtp',
'host' => 'a2plcpnl0296.prod.iad2.secureserver.net;a2plcpnl0296.prod.iad2.secureserver.net',
'port' => 587,
'from' => ['address' => 'contact@theventuregame.com', 'name' => 'The Venture Game TM'],
'encryption' => 'tls',
'username' => 'xxx',
'password' => 'yyy',
'pretend' => false,
当我尝试使用这些配置发送电子邮件时,错误显示如下:
无法与主机a2plcpnl0296.prod.iad2.secureserver.net建立连接;a2plcpnl0296.prod.iad2.secureserver.net[php_network_getaddresses:getaddrinfo失败:没有已知的主机。#0]
我想我知道问题是什么,将SMTP身份验证添加到true,但我不知道该将该参数放在哪里
另一方面,我有这段代码,它工作得非常好,但我想要Laravel one配置,因为它更干净:
$this->mail = new PHPMailer;
$this->mail->isSMTP(); // Set mailer to use SMTP
$this->mail->Host = 'a2plcpnl0286.prod.iad2.secureserver.net;a2plcpnl0286.prod.iad2.secureserver.net'; // Specify main and backup SMTP servers
$this->mail->SMTPAuth = true; // Enable SMTP authentication
$this->mail->Username = 'xxx'; // SMTP username
$this->mail->Password = 'yyy'; // SMTP password
$this->mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$this->mail->Port = 587; // TCP port to connect to
$this->mail->From = 'contact@theventuregame.com';
$this->mail->FromName = 'The Venture Game TM';
正如您在上述代码中看到的,我有:
$this->mail->SMTPAuth = true;
我想,如果我能在拉雷维尔的某个地方宣布它,它就会起作用
有什么建议吗?这不是身份验证的问题-它没有走那么远 将记录
主机
属性,并在上拆分主机
字符串代码>。您已在主机
属性中两次列出同一服务器。尝试将其设置为a2plcpnl0286.prod.iad2.secureserver.net
。除此之外,设置SMTPDebug=4
,您将得到详细的输出,告诉您有关连接的信息
您应该检查电子邮件服务器是否确实可以访问-如何访问将在中介绍
确保您也在使用
我还注意到你在GoDaddy上,他有着臭名昭著的糟糕的电子邮件支持。很抱歉,确认晚了。。它就像一个符咒:)必须在“;”之后移除剩余的绳子