mail exception unable to manage try catch
How do I handle invalid domain error?
I tried to insert the mail function inside a try catch construct, but the exception is not handled and show the error in img
thnks
![No description](https://answer-overflow-discord-attachments.s3.us-east-1.amazonaws.com/1257350010446549063/image.png)
9 Replies
Did you actually import the exception class?
Also... did you restart the queue if using a queue
no man not imported
Do it and try again.
ok thanks its works
Do you understand why?
Fairly sure \ on the Exception should suffice too.
Solution![No description](https://answer-overflow-discord-attachments.s3.us-east-1.amazonaws.com/1257368670896656466/image.png)
yes I use
![No description](https://answer-overflow-discord-attachments.s3.us-east-1.amazonaws.com/1257368670896656466/image.png)
and ADD use Symfony\Component\Mailer\Exception\UnexpectedResponseException;