Q: I can read messages from my IMAP server with other mail clients, but even though I can connect to the server using JavaMail, when I use JavaMail to read some messages it fails. Doesn't that mean there's a bug in JavaMail?
A: No, not usually. Most other mail clients make very little use of the rich IMAP protocol. They use the IMAP protocol as little more than a variant of the POP3 protocol, typically downloading the entire message to the client and parsing it in the client. This allows them to avoid all sorts of parsing and protocol bugs in many IMAP servers, but of course it comes at the cost of being less efficient because they don't take advantage of the IMAP protocol's ability to fetch only the parts of the message that are needed. These server bugs often manifest themselves as the following exception on the client: javax.mail.MessagingException: Unable to load BODYSTRUCTURE
The best approach when running into server bugs of this sort is to contact the vendor of the server and get them to fix their product. Contact javamail@sun.com and we'll help you pinpoint the problem so that you can report it to the server vendor. If you can't get a fix from the server vendor, the following technique will often allow you to work around these server bugs:
// Get the message object from the folder in the // usual way, for example: MimeMessage msg = (MimeMessage)folder.getMessage(n); // Use the MimeMessage copy constructor to make a copy // The cmsg object is disconnected from the server so |




덧글