aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes how to get status mail using javamail. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "how to get status mail using javamail." Watch "how to get status mail using javamail." New topic
Author

how to get status mail using javamail.

chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

Hi All,

I want to get the status mail after sending the mail using javamail.
I succeeded in sending the mail to multiple users, but unable to get the status of the send mail.
Please tell me what to do for getting the status mail back.

thank you.


http://www.androcid.com/
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42911
    
  68
I think any solution would have to be specific to the mail server. JavaMail uses SMTP for sending mail, and that doesn't provide this kind of feedback. And even if the mail server can somehow be queried about which mails were sent, they may still be delayed or bounced later.
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

so what is solution for this using java.....


I have to prepare a report where I have to show status of the send mail as
Successful :
Bounced mail :
failure :

is there any to achieve this functionality.....


thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42911
    
  68
Successful

That depends on your definiton of "Successful". Even though your server may have sent the mail, the target server may silently drop it as spam. Or it could be delayed for hours or days before it is finally delivered or bounced.

Bounced mail

You need to check the mailbox associated with the address you're using to send the mails. That's where bounces would end up. Note that it will also contain messages about mail being delayed that is ultimately delivered - which would not be bounces. Plus, over time, that mailbox will attract spam. If you need to track individual mails, the easiest would be to add a unique ID to the subject (which will usually be contained in the bounce message).

failure

I assume you mean at the time of sending, like if the address is syntactically incorrect, or no email server for the target address can be found? That would result in exceptions you can handle in the mail sending code.
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

thanks Ulf,

successful : the mail which is delivered to the client.

failure : a bounced mail from the server will work for me.....

I also want to show queued mail (which are successfully send but not delivered to the client)


can I get DSN (delivery status notification) for each mail I send.....
In javamail api com.sun.mail.dsn package provides 3 classes as
DeliveryStatus
MessageHeaders
MultipartReport

how to use these classes (I'm unable to get any info about these classes in tutorials)

thanks....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get status mail using javamail.