Error in BODYSTRUCTURE processing? RRS feed

  • Question

  • Hello,

    I have exchange mailbox with IMAP support enabled. When I'm trying to connect to this mailbox using Java, I sometimes get errors. The error occurs when incoming email contain information about certificate. If I will turn signing off my e-mail messages it will process messasges just fine (this is not an option for us in final solution).

    The error is:


    javax.mail.MessagingException: Unable to load BODYSTRUCTURE

     at com.sun.mail.imap.IMAPMessage.loadBODYSTRUCTURE(IMAPMessage.java:1280)

     at com.sun.mail.imap.IMAPMessage.getContentType(IMAPMessage.java:443)

     at javax.mail.internet.MimeBodyPart.isMimeType(MimeBodyPart.java:1059)

     at javax.mail.internet.MimeMessage.isMimeType(MimeMessage.java:965)



    and the body structure is as follows:


    (BODYSTRUCTURE (("text" "html" ("charset" "us-ascii") NIL NIL "quoted-printable" 2634 58 NIL NIL NIL NIL)

    ("message" "delivery-status" NIL NIL NIL "7BIT" 512 NIL NIL NIL NIL) ("message" "rfc822" NIL NIL NIL "7BIT" 14874 

    ("Wed, 7 Sep 2011 11:11:00 +0200" "Subject - nr 00000001 / C-858 -" (("email.account" NIL "email.account" "some.server")) 

    NIL (("email.account" NIL "email.account" "some.server")) (("some.account@gmail.com" NIL "some.account" "gmail.com")) 

    NIL NIL NIL "<2101883720.77.1315386660534.JavaMail.root@mail.server.host>") 

    ("multipart" "signed" ("protocol" "application/pkcs7-signature" "micalg" "sha1" "boundary" "----=_Part_76_1396430248.1315386660525") NIL NIL "7BIT" -1 NIL NIL NIL NIL) 252 NIL NIL NIL NIL) 

     "report" ("boundary" "_000_ee202742dd1c42508e093bd2e5968da7_" "report-type" "delivery-status") NIL "en-US"))



    The interesting part here is this fragment:


    ("multipart" "signed" ("protocol" "application/pkcs7-signature" "micalg" "sha1" "boundary" "----=_Part_76_1396430248.1315386660525") NIL NIL "7BIT" -1 NIL NIL NIL NIL) 252 NIL NIL NIL NIL) 

      "report" ("boundary" "_000_ee202742dd1c42508e093bd2e5968da7_" "report-type" "delivery-status") NIL "en-US"))



    It is just the same situation as described here:


    According to this information, it is a bug in Exchange.

    Unfortunately the workaround with additional Java processing is not an option for us.


    So I have a few questions:

    - is there any fix to this problem (I have done some research through Microsoft Suppor Knowledge Base and found some     problems related with BODYSTRUCTURE, but nothing related to my case) ?

    - if no solution yet, is there any workaround?


    I am using Exchange 2007.



    • Edited by pegalover Wednesday, September 7, 2011 2:34 PM
    Wednesday, September 7, 2011 2:25 PM


  • Hi
       It is odd issue. I search it by internal database. It is bug.
       I find this case. It is not good news. No fixed No workaround.

    Java application isn't able to download digitally signed message via IMAP from a mailbox on Exchange 2007, it works when the mailbox is on Exchange 2003.


    IMAP Bodystructure for signed MIME messages is incorrect.


    A request was made to change the design, but was regretfully declined due to the amount of code necessary to fix the problem.

    Detail : FETCH n BODY" command does not return correct MIME-IMB body structure against a digitally signed message. Exchange 2007 seems return first 'Content-Type' header as is. Moreover, Exchange 2007 seems recognize such messages as a single part message. Because "FETCH n BODY[1]" returns a response that body and digital signature part are combined together.

    By the way,it is code issue. You should post it to development forum.


    • Marked as answer by Terence Yu Friday, September 16, 2011 1:30 AM
    Thursday, September 8, 2011 6:28 AM