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
Solution:
yes I use
No description
Jump to solution
9 Replies
Dennis Koch
Dennis Koch6d ago
Did you actually import the exception class?
toeknee
toeknee6d ago
Also... did you restart the queue if using a queue
Zoltar
Zoltar6d ago
no man not imported
Dennis Koch
Dennis Koch6d ago
Do it and try again.
Zoltar
Zoltar6d ago
ok thanks its works
Dennis Koch
Dennis Koch6d ago
Do you understand why?
toeknee
toeknee6d ago
Fairly sure \ on the Exception should suffice too.
Solution
Zoltar
Zoltar6d ago
yes I use
No description
Zoltar
Zoltar6d ago
and ADD use Symfony\Component\Mailer\Exception\UnexpectedResponseException;