问题
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 ?
回答1:
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=*****
回答2:
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
回答3:
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.
回答4:
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
回答5:
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
来源:https://stackoverflow.com/questions/30624194/connection-could-not-be-established-with-host-smtp-gmail-com-operation-timed-ou