I have a problem with my laravel email client. I need to send email by click button.
my code: .env
MAIL_DRIVER=smtp
MAIL_HOST=mail.somedomain.com
MAIL_PORT=587
MAIL_USERNAME=test@somedomain.com
MAIL_PASSWORD=123456
MAIL_ENCRYPTION=null
I think it is good configuration, of course i'm using my domain :)
next in controller I have code like this:
Mail::send('home', array('firstname' => "fname"), function($message){
$message->to("testsend@somedomain.com")->subject('Welcome to the Laravel');
});
Website is open normally but email not send
In Gmail account
My account > Sign In And Security > Sign In to google, enable two step verification
Create One App and generate password
In your .env file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=apppassword // this is created from gmail app password
MAIL_ENCRYPTION=tls
And Then run php artisan config:cache