Re: Section 14.3 Sending Email -- com.sun.mail.smtp.SMTPAddressFailedException
When that Java Mail Property is set to true, an exception is still thrown, but despite the exception being thrown the email will still be sent. When the property is false (the default), the entire email is canceled and not sent.
The exception when caught is of class org.springframework.mail.MailSendException.
When "getMessage() is issued against the exception, the following appears:
com.sun.mail.smtp.SMTPSendFailedException: 250 Mail queued for delivery.
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 SpitterFoo.IDoNotExist@www.spittle.org... No such user
com.sun.mail.smtp.SMTPAddressFailedException: 550 SpitterFoo.IDoNotExistToo@www.spittle.org... No such user
I wrote a routine that uses RegExp to parse that message and create an Array containing all the bad email addresses. Maybe that is overkill, or maybe it would be useful to expand the example to include that too. .
|