You can you use tinker to check if email are sent correctly in a Laravel project.
Launch Tinker using this command
php artisan tinker
The shell is launched
Psy Shell v0.12.9 (PHP 8.2.4 — cli) by Justin Hileman
>
Now add the following code:
Mail::raw('This is an email test! Please confirm receipt.', function ($message) {
$message->to('[email protected]')
->subject('Laravel email test');
});
If it's OK, a message like this will be shown:
= Illuminate\Mail\SentMessage {#7055}
Otherwise an exception will rise with the reason. ex:
Symfony\Component\Mailer\Exception\TransportException:Connection could not be established with host "135.45.15.32:25": stream_socket_client(): Unable to connect to 135.45.15.32:25