gmailimapjakarta-mailgmail-imapeml

Unable to load BODYSTRUCTURE exception with an email containing an .eml file sent using Thunderbird


We have an application that accesses an Gmail account (IMAP) using Java Mail API. Works fine for all types of emails except for a message that contains an .eml file as attachment and the message is sent using Thunderbird.

Here is the exception stack trace when trying to retrieve that message . Please advise.

Caused by: com.google.code.javax.mail.MessagingException: Unable to load BODYSTRUCTURE
        at com.google.code.com.sun.mail.imap.IMAPMessage.loadBODYSTRUCTURE(IMAPMessage.java:1377)
        at com.google.code.com.sun.mail.imap.IMAPMessage.getContentType(IMAPMessage.java:492)

Solution

  • What version of JavaMail are you using?

    You might be running into one of the Gmail bugs described here.