Can't Send Emails Using Laravel 5.0.33
I was trying to send emails using the code below:
'driver' => 'smtp', 'host' => 'a2plcpnl0296.prod.iad2.secureserver.net;a2plcpnl0296.prod.iad2.secureserver.net', 'port' => 587, 'from' => ['address' => '[email protected]', 'name' => 'The Venture Game TM'], 'encryption' => 'tls', 'username' => 'xxx', 'password' => 'yyy', 'pretend' => false,
When I try to send email using these conf the error shows as below: Connection could not be established with host a2plcpnl0296.prod.iad2.secureserver.net;a2plcpnl0296.prod.iad2.secureserver.net [php_network_getaddresses: getaddrinfo failed: No such host is known. #0].
I think I know what the issue is, to add SMTP Authentication to true, but I just dont know where can I put that parameter.
On the other hand I have this code which works perfectly fine, but I would want the Laravel one config as it is more clean:
$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 = '[email protected]'; $this->mail->FromName = 'The Venture Game TM';
As you can see on the above code I have this:
$this->mail->SMTPAuth = true;
Wich I think if I would have it declared somewhere in Laravel would make it work.
This isn't an auth problem - it's not getting that far.
Host property is documented here and the
Host string is split on
;. You have listed the same server twice in your
Host property. Try just setting it to
a2plcpnl0286.prod.iad2.secureserver.net. Beyond that, set
SMTPDebug = 4 and you'll get verbose output telling you about the connection.
You should check that that email server is actually accessible - how to do that is covered in the troubleshooting guide.
Make sure you're using the latest PHPMailer too.
I also note you're on GoDaddy, who have notoriously bad email support.
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?