i used
$email = $dist->email;
Mail::send('emails.welcome', $input1, function ($message) use($input1,$email) {
$message->from('myemail@gmail.com', "Messenger");
$message->subject("New User Registered");
$message->to($email);
});
and my .env file is
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=psw
MAIL_ENCRYPTION=tls
Yes this i got from Stack overflow. But unfortunately its not working. Gone through the several answers. Finally ended up asking here. also there is no errors in
my config/mail.php
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
Is its necessary to generate the separate app password to use gmail id as username?