Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get status mail using javamail.

 
chetan dhumane
Ranch Hand
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic