I am trying to send email to user provided email id and I am getting below :
org.springframework.mail.MailSendException:
Failed messages: javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException
Now the problem is I can catch MailSendException and send a Meaningful error message to Client saying, please provide valid emailId, but MailSendException is a very generic exception to catch and catching it doesn't guarantee that the exception has occurred because of invalid email id. This exception can occur for various other reasons.
My Problem is that I want to catch SMTPAddressFailedException but unfortunately in this case it is a nested exception and the actual exception thrown by Spring is a very generic MailSendException. Please suggest