Thursday, March 2, 2017

Laravel send mail via Gmail fails - cannot connect to server

The server, Ubuntu 16.04, with Nginx webserver. I am running 2 virtual hosts, both have Laravel apps running. One is Laravel 5.1, the other is 5.4.

I have the same contact us form under both Laravel instances. The sendmail function on the controller is the same for both (I know I need to refactor this functionality off of the controller :-) ) Both have the same config/mail.php settings. .env is the same on both, other than the username and password. Both gmail accounts have insecure applications enabled / allowed.

The one running under Laravel 5.1 works perfectly. The one under 5.4 gives a timeout error when trying to connect to gmail.

Any ideas on what the fix should be?




via Roger Creasy

Advertisement