Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does 'bodyPart.isMimeType("text/plain")' give the error 'Unable to load bodystructure'?

I am creating an application in Java to read mails from my GoDaddy webmail through Java. I have used javax.mail for this. When I debug the program, it gives an error at the line: bodyPart.isMimeType("text/plain")

Unexpectedly, it processes the first mail in the right way but gives the error for the second mail.

Here is the complete stack trace:

javax.mail.MessagingException: Unable to load BODYSTRUCTURE
    at com.sun.mail.imap.IMAPMessage.loadBODYSTRUCTURE(IMAPMessage.java:1306)
    at com.sun.mail.imap.IMAPMessage.getContentType(IMAPMessage.java:465)
    at javax.mail.internet.MimeBodyPart.isMimeType(MimeBodyPart.java:1050)
    at javax.mail.internet.MimeMessage.isMimeType(MimeMessage.java:986)
    at asanaLambdaIntegrationDebugMode.getNameMailIdFromMessage(asanaLambdaIntegrationDebugMode.java:1318)
    at asanaLambdaIntegrationDebugMode.main(asanaLambdaIntegrationDebugMode.java:978)

Any suggestions on this please?

like image 598
Deva Avatar asked Jul 19 '18 06:07

Deva


1 Answers

Give a try to the workaround described here: https://javaee.github.io/javamail/FAQ#imapserverbug

Hope this helps.

like image 125
TacheDeChoco Avatar answered Nov 16 '22 13:11

TacheDeChoco