Have you authorized your google account to be accessed from a third party in the google account configuration ?
Oct 21, 2022
13
Level 1
Laravel9 - Error when sending mail (Expected response code "250" but got an empty response.).
I created a temporary mail in (Google Workspace) and connected everything to the test site, but when sending an email from the site I get an error (Expected response code "250" but got an empty response.)
Here is the code from file .env
MAIL_MAILER=smtp
MAIL_HOST=smtp-relay.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
And here is the controller
$email_admin = "[email protected]";
$to_name = 'Reservation';
$to_email = '[email protected]';
$to_client_email = $request->email;
Mail::send('mail', compact('reservations'), function ($message) use ($reservations, $to_email) {
$message->from("[email protected]", 'username');
$message->to($to_email)->subject('laravel reservation');
});
$repsond=Mail::send('mail_client', compact('reservations'), function ($message) use ($reservations, $to_client_email) {
$message->from("[email protected]", 'username');
$message->to($to_client_email)->subject('laravel reservation client');
});
Please or to participate in this conversation.