Link to home
Start Free TrialLog in
Avatar of abuyusuf35
abuyusuf35

asked on

JavaMail

When sending a mail with Java mail API how do I detect if the email failed delivery due to for example an incorrect email address - I am catching SendFailedException but even after giving a incorrect email address the exception does not appear to get thrown ? Any ideas ?
Thanks
Avatar of for_yan
for_yan
Flag of United States of America image


I don't think it can always diagnose wrong address, only in some obvious cases.
 It will bounce back to From Address otherwise.
My impression was that SendFailedException will mostly happen if there is some problem before or in communication with smtp server
If it submits to smtp server - it is in the hands of the server - you proabbly need to do
something very special to figure out the future fate of your message

You can look at this discussion, pretty much in the same vein and same opinion:
http://www.velocityreviews.com/forums/t127909-javamail-does-not-throw-exceptions.html
Avatar of abuyusuf35
abuyusuf35

ASKER

Anyone has a solid example which uses DeliveryStatus, MessageHeaders & MultipartReport ?
Thanks
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This didn't work for me. I have a class implementing TransportListener which returns a status on messages delivered or not - the only issue is that for some email addresses I don't get a status until the email has bounced. Is there a way to get this information before hand or by reading messages from the SMTP server.
it doesn't look that you can have uniform way - it seems to depend on configuration of smtp server - what works on one doesn't work on another - even withe same server it may depend on the next level contact configuration
I've requested that this question be closed as follows:

Accepted answer: 0 points for abuyusuf35's comment http:/Q_27379988.html#36917479

for the following reason:

none of the suggested solutions answered my question
cancel