error handling on SMTP sending using javax.mail
I writing a mail client for sending of email notification using Javax.mail SMTP. I need to validate the mail delivery开发者_JAVA百科. my first step ofcourse was to catch built in exception.
My question does those exceptioon cover delivery errors (i.e. failed delivery becouse of wrong adrress, target server not found etc) or do I need to do extra work to cover that.
Thanks,
Alex
Once the email is successfully delivered to the destination server, it's gone. If that server is a relay (as you would typically find in a corporate environment) the message could bounce later when the relay tries to send it to the real destination.
At that poing, a bounce message would be returned to the sending address. If you need to handle those, you need to ensure that the sending address is deliverable to a mailbox to which you have access. Then you need to somehow (i.e. procmail) get the incoming bounces to another program you write which handles them.
精彩评论