When I send a notification with Laravel 9, sometimes I get the response:
Expected response code "250/251/252" but got code "550", with message "550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in virtual mailbox table".
The entire queue then breaks off and other e-mails that would work are not sent either. With GMX or GMAIL it works, but with a few emails from hosting-services this message appears.
I've already tried a try and catch method, but without success:
use Exception;
try { Notification::route('mail', $email_adresses)->notify(new MinStock($item));
} catch(\Exception $e) { logger('Notification Exception: ', $e->getMessage(), "\n");
}I could change something on the server side, but that's not the solution, since I don't have access to all servers.
It would be nice if the try and catch method would work and I could inform the user about the non-existent email address.
Anyone an idea?
1 Answer
The error message Recipient address rejected: User unknown in virtual mailbox table indicates that the email address you are trying to send the notification to does not exist or is not recognized by the email service provider 1.
You can add validation(with laravel Validator) before the notify() to the email and use some rules for emails.