I try to send email to fake address. And I can't catch error if this email address is not available and email can not be delivered. In SMTP-server logs I see:
Fri 2020-12-11 12:08:58.582: 03: --> 250-STARTTLS
Fri 2020-12-11 12:08:58.582: 03: --> 250 SIZE
Fri 2020-12-11 12:08:58.582: 02: <-- MAIL FROM:<my_email@mydomain.com>
Fri 2020-12-11 12:08:58.583: 03: --> 250 2.1.0 Sender OK
Fri 2020-12-11 12:08:58.583: 02: <-- RCPT TO:<somefakeaddress@mydomain.com>
Fri 2020-12-11 12:08:58.584: 03: --> 550 5.1.1 Recipient unknown <mi@f
Fri 2020-12-11 12:08:58.585: 02: <-- RSET
Fri 2020-12-11 12:08:58.585: 03: --> 250 2.0.0 RSET? Well, OK
Fri 2020-12-11 12:08:58.586: 02: <-- QUIT
Fri 2020-12-11 12:08:58.586: 03: --> 221 2.0.0 See ya in cyberspace
Fri 2020-12-11 12:08:58.586: 04: SMTP session terminated (Bytes in/out
But in my Laravel app I can't catch this error even if I use Event Listeners https://laravel.com/docs/7.x/mail#events
Of course, the code
Mail::to('somefakeaddress@mydomain.com')->send(new Mailable($mail_data));
returns nothing.
Is there any idea how to catch the error of the SMTP session in Laravel?