Skip to content
Advertisement

Parsing bounced emails using Javamail and DSN.jar

I found the way to redirect my bounced emails using my own smtp server. Now, as per the requirement, I should be able to read the bounced emails using my program, like reason for bouncing, receiver’s email address, email content and etc. Stackoverflow suggested that dsn.jar might be helpful. I saw it has some methods. But I don’t find any examples to check how it is working. Here is the way I am redirecting the bounced emails, my question is how to add a functionality to read the bounced emails here inside/outside the following program ? Please help.

JavaScript

Advertisement

Answer

Reading a bounced message is like reading any other message – you have to connect to the Store, open the Folder, and read the Message. Once you have a Message object that represents a bounced message, you can use the kind of code you have commented out above to process the content of that message. But note that the Message object will not be the Message object you sent, but rather a completely different Message object that comes from the Folder associated with the redirectingAddress@gmail.com account.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement