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

半腔热情 提交于 2019-12-03 12:18:59

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.

poonam rawal

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!