How to configure `.env` file in Laravel for sending mail?
21,775
clear the env file cache
php artisan config:cache
php artisan cache:clear
configure mail.php
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => '[email protected]',
'name' => 'Your Title'
],
'encryption' => 'tls',
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
Author by
Admin
Updated on August 23, 2021Comments
-
Admin over 2 years
Getting error while sending mail from a in
Laravel
website.local.ERROR: Connection could not be established with host smtp.gmail.com [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. #10060]
.env
fileMAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 [email protected] MAIL_PASSWORD=app_specific_password MAIL_ENCRYPTION=tls
Already googling but can't get the solution yet. Whatever I change(
PORT
,DRIVER
) in.env
file always shows the same error.How to solve it !!