Discussion:
Is there a way to validate completeness of a message fetched from IMAP folder?
saurabhd
2009-05-14 11:06:00 UTC
Permalink
I plan to use JavaMail for one of my projects, where I need to download some
emails from a IMAP store (gmail), and move them to a issue tracking system.

Is there a way to validate that email was downloaded / fetched with no
corruptions (or partial downlaods)?

I understand from a response at stack overflow that "The IMAP protocol will
tell you how many octets are going to be transfered when you issue the FETCH
command.". Is there a way in JavaMail to get the value of "how many octects
are going to be transfered", so I can cross check the file, once JavaMail
API returns a success for a fetch?

I also found getContentMD5 in IMAPMessage class. Do all IMAP servers support
this? i.e. can I get the contentMD5 before fetching the message and then
compare it to ensure completeness of the email?
http://java.sun.com/products/javamail/javadocs/com/sun/mail/imap/IMAPMessage.html#getContentMD5()

Thanks
Saurabh
--
View this message in context: http://www.nabble.com/Is-there-a-way-to-validate-completeness-of-a-message-fetched-from-IMAP-folder--tp23538398p23538398.html
Sent from the Javamail mailing list archive at Nabble.com.

===========================================================================
To unsubscribe, send email to ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".
Bill Shannon
2009-05-14 17:55:56 UTC
Permalink
Post by saurabhd
I plan to use JavaMail for one of my projects, where I need to download some
emails from a IMAP store (gmail), and move them to a issue tracking system.
Is there a way to validate that email was downloaded / fetched with no
corruptions (or partial downlaods)?
No. Although generally you'll get an exception if there's a problem.

The biggest problems are usually *not* undetected corruption of the data,
but rather failures or bugs in the mail server.
Post by saurabhd
I understand from a response at stack overflow that "The IMAP protocol will
tell you how many octets are going to be transfered when you issue the FETCH
command.". Is there a way in JavaMail to get the value of "how many octects
are going to be transfered", so I can cross check the file, once JavaMail
API returns a success for a fetch?
You can use the getSize method, but see all the caveats in the javadocs.
Post by saurabhd
I also found getContentMD5 in IMAPMessage class. Do all IMAP servers support
this? i.e. can I get the contentMD5 before fetching the message and then
compare it to ensure completeness of the email?
Not all messages will include it.

===========================================================================
To unsubscribe, send email to ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".
Loading...