Connection could not be established with host smtp.gmail.com [Operation timed out #60]

I can't sent out any email in my local environment.

I keep getting :

_

.env file.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=my-email@gmail.com
MAIL_PASSWORD=*****

Note : Surprisingly - I have the same setting in my production server, and it works perfectly.

Any hints / suggestions ?

Answers


Update my driver line to

MAIL_DRIVER=sendmail

It works on the first try.

Final .env file should look like this

MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=my-email@gmail.com
MAIL_PASSWORD=*****

For me the following worked with GMAIL:

'encryption' => 'ssl',

.env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=xxx@gmail.com
MAIL_PASSWORD=xxx

1: Either you must allow less secure apps or use app password by enabling 2 step verification on your gmail acc. 2: Disable any antivirus on your machine.


Change setting in .env file and keep your mail server's credentials after setup of smtp

MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=465 MAIL_USERNAME=xxx MAIL_PASSWORD=xxx


Laravel also includes drivers for the Mailgun and Mandrill HTTP APIs. These APIs are often simpler and quicker than the SMTP servers. Both of these drivers require that the Guzzle 5 HTTP library be installed into your application. You can add Guzzle 5 to your project by adding the following line to your composer.json file:

"guzzlehttp/guzzle": "~5.0"

composer update

Mailgun Driver

To use the Mailgun driver, set the driver option to mailgun in your config/mail.php configuration file. Next, create an config/services.php configuration file if one does not already exist for your project. Verify that it contains the following options:

'mailgun' => [
    'domain' => 'your-mailgun-domain',
    'secret' => 'your-mailgun-key',
],

Mandrill Driver

To use the Mandrill driver, set the driver option to mandrill in your config/mail.php configuration file. Next, create an config/services.php configuration file if one does not already exist for your project. Verify that it contains the following options:

'mandrill' => [
    'secret' => 'your-mandrill-key',
],

Basic Usage

The Mail::send method may be used to send an e-mail message:

Mail::send('emails.welcome', ['key' => 'value'], function($message)
{
    $message->to('foo@example.com', 'John Smith')->subject('Welcome!');
});

http://laravel.com/docs/5.0/mail


Need Your Help

Python xlwt - accessing existing cell content, auto-adjust column width

python xlwt xlrd

I am trying to create an Excel workbook where I can auto-set, or auto-adjust the widths of the columns before saving the workbook.

Using Chart.js on Angular 4

javascript angular typescript chart.js

I'm trying to use Chart.js with Angular 4, I saw an example on the chart.js documents but it's using a < script > tag to pull the script so it doesn't work on the component. This is how I tried ...