I am trying to send the mail using smpt on google mail my .env file is
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=MYEmailAddress
MAIL_PASSWORD=MyPassword
MAIL_ENCRYPTION=tls
and the server code is
try {
Mail::send([], [], function ($message) use ($completeView,$emailAdress) {
$message->to($emailAdress, $emailAdress)->subject("Property List");
$message->from("Myemail", "info")->setBody($completeView, 'text/html');
});
} catch (\Exception $e) {
return array([$e->getMessage(),"Myemail"]);
}
I also enable the Less secure app access in gmail and the response I get from the server is
Expected response code 250 but got code \"530\", with message \"530 5.7.1 Authentication required