我试图用下面的代码发送电子邮件:
'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,当我试图使用这些conf发送电子邮件时,错误显示如下:无法与主机a2plcpnl0296.prod.iad2.secureserver.net;a2plcpnl0296.prod.iad2.secureserver.net建立连接: php_network_getaddresses: getaddrinfo失败:不知道这样的主机。#0。
我想我知道问题是什么,把SMTP身份验证添加到真,但我只是不知道我可以把这个参数放在哪里。
另一方面,我的代码工作得非常好,但是我希望Laravel配置更干净:
$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; 我想如果我能在拉拉维尔的某个地方宣布这件事会让它成功的话。
有什么建议吗?
发布于 2016-01-11 08:11:28
这不是个问题--还没走那么远。
Host属性被文档化为这里,Host字符串在;上被拆分。您已经在Host属性中列出了两次相同的服务器。只需将其设置为a2plcpnl0286.prod.iad2.secureserver.net即可。除此之外,设置SMTPDebug = 4,您将得到详细的输出,告诉您有关连接的信息。
您应该检查该电子邮件服务器实际上是可访问的--如何做到这一点在故障排除指南中涵盖。
确保您也在使用最新PHPMailer。
我也注意到你在GoDaddy上,谁有臭名昭著的糟糕的电子邮件支持。
https://stackoverflow.com/questions/34715673
复制相似问题