locked
Exhange 2016 IMAP fetch BODYSTRUCURE not entire name/filename returned RRS feed

  • Question

  • Hi

    This is an IMAP question coming from working with javamail towards an exchange server 2016

    Some mails have its attachment splitted like:
            name*0="1858289404-Direct Line-TK-150-EIC-XX 123-Sonstiges_185828940";
            name*1="4_170627-1715_TB28.pdf"
         Content-Transfer-Encoding: base64
         Content-Dis;
            filename*0="1858289404-Direct Line-TK-150-EIC-XX 123-Sonstiges_185828940";
            filename*1="4_170627-1715_TB28.pdf"
        

    If I get this mail-attachments with javamail via imap only "name" "1858289404-Direct Line-TK-150-EIC-XX 123-Sonstiges_185828940" is returned. So the 2nd part is lost: name*1="4_170627-1715_TB28.pdf"
    Javamail calls fetch 1 (BODYSTRUCTURE) in this step.
    I can also replicate this by calling fetch 1 (BODYSTRUCTURE) via telnet/imap - see below:

    So what am I doing wrong?
    Or is there any property to be set in the exchange server? (javamail property is set mail.mime.decodeparameters=true)
        
    ? login ...
    ? OK LOGIN completed.
    ? select emailtest?
    * 1 EXISTS
    * 0 RECENT
    * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
    * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
    * OK [UIDVALIDITY 76] UIDVALIDITY value
    * OK [UIDNEXT 2812] The next unique identifier value
    ? OK [READ-WRITE] SELECT completed.
    ? fetch 1 (BODYSTRUCTURE)
    * 1 FETCH (BODYSTRUCTURE ((("text" "plain" ("charset" "ISO-8859-15") NIL NIL "quoted-printable" 2233 59 NIL NIL NIL NIL)("text" "html" ("charset" "ISO-8859-15") NIL NIL "quoted-printable" 16796 584 NIL NIL NIL NIL) "alternative" ("boundary" "----=_Part_337_1840082595.1498576634070") NIL NIL)("application" "octet-stream" ("name" "1858289404-Direct Line-TK-150-EIC-XX 123-Sonstiges_185828940") NIL NIL "base64" 693376 NIL ("attachment" ("filename" "1858289404-Direct Line-TK-150-EIC-XX 123-Sonstiges_185828940")) NIL NIL)("application" "octet-stream" ("name" "1858289404-Direct Line-TK-150-EIC-XX 123-Sonstiges_185828940") NIL NIL "base64" 204776 NIL ("attachment" ("filename" "1858289404-Direct Line-TK-150-EIC-XX 123-Sonstiges_185828940")) NIL NIL)("application" "octet-stream" ("name" "1858289404-Direct Line-TK-150-EIC-XX 123-Sonstiges_185828940") NIL NIL "base64" 162392 NIL ("attachment" ("filename" "1858289404-Direct Line-TK-150-EIC-XX 123-Sonstiges_185828940")) NIL NIL)("application" "octet-stream" ("name" "1858289404-Direct Line-TK-150-EIC-XX 123-Sonstiges_185828940") NIL NIL "base64" 181802 NIL ("attachment" ("filename" "1858289404-Direct Line-TK-150-EIC-XX 123-Sonstiges_185828940")) NIL NIL) "mixed" ("boundary" "----=_Part_338_465097449.1498576634070") NIL NIL))
    ? OK FETCH completed.
    ? logout
    ? BAD Command Error. 11
    * BYE Connection closed. 14
    Wednesday, August 2, 2017 8:25 AM

All replies

  • Hi,

    Thanks for your contacting our forum.

    Make sure the IMAP service are running correctly on Exchange server firstly.

    Does this issue occurs with all size and types of attachments? Any limitations of attachment size and types configured?

    Please check if any events on Exchange server related to IIS/EWS.

    We can check the IIS log in the following path and check if any error message shown up.

    C:\inetpub\logs\LogFiles\W3SVCx

    Hope it helps.


    Regards,

    Jason Chao


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    • Edited by Jason.Chao Thursday, August 3, 2017 4:57 AM
    • Proposed as answer by Jason.Chao Monday, August 7, 2017 9:24 AM
    Thursday, August 3, 2017 4:57 AM
  • Here are the results we came to:
    1. No events for Exchange server for this issue.

     2. I do not see any Errors in the log at C:\inetpub\logs\LogFiles\W3SVCx.

     3. We have this problem with some mails. Some customers mail their attachments in this way: long attachement-names splitted in in several parts: Then the problem occurs with all size and type of attachments (from JPG to PDF – from small to large attachments) we receive – IF the filename-length of the attachment is > 60 and the filename is split into 2 or more lines:

    There are a some Stackoverflow-Posts, which discuss this issue(RFC 2231) - as this one: https://stackoverflow.com/questions/34128695/issue-with-javamail-attachments

    I paste here a testmail (test.eml), with which I can reproduce the problem: it returns only the first part (name*0 )– when I fetch the bodystructure with imap towards exchange 2016 (also if do this with javamail 1.5.2 or 1.5.4).

    So is this a disabled property in exchange server 2016 or an error or do I still miss something?
    Best regards, Arno

    -------------------------- the test.eml

    X-NoSpamProxy-Tests: Content filtering: Pass;
    X-NoSpamProxy-Rating:
    X-NoSpamProxy-TrustedMail: no
    X-NoSpamProxy-CYRENID:
    X-NoSpamProxy-Scl: 0.00
    X-NetatworkMailGateway-Sender: test@test.com
    X-NoSpamProxy-Rule: Whitelist
    X-NoSpamProxy-Gateway: 192.168.0.1:60029
    Received: from test.test.test.com (unknown [192.168.0.1])
        by smtp1.test.test.com (Postfix) with ESMTP id 1111111111;
        Tue, 27 Jun 2017 17:17:14 +0200 (CEST)
    Date: Tue, 27 Jun 2017 17:17:14 +0100
    From: <test@test.com>
    X-CSA-Complaints: test-complaints@test.com
    To: <testcompany@test.com>
    Message-ID: <111111111111.111.1111111111@TEST>
    Subject: TestMail
    Content-Type: multipart/mixed;
        boundary="----=_Part_338_465097449.1498576634070"
    Return-Path: test@test.com
    X-OriginalArrivalTime: 27 Jun 2017 15:18:33.0458 (UTC) FILETIME=[A3FCCD20:01D2EF58]
    X-MS-Exchange-Organization-Network-Message-Id: 2438150e-1111-1111-1111-08d4bd6fc67d
    X-MS-Exchange-Organization-AuthSource: S-EXCH-2.TEST.TEST.COM
    X-MS-Exchange-Organization-AuthAs: Anonymous
    X-MS-Exchange-Transport-EndToEndLatency: 00:00:00.4688020
    MIME-Version: 1.0

    ------=_Part_338_465097449.1498576634070
    Content-Type: multipart/alternative;
        boundary="----=_Part_337_1840082595.1498576634070"

    ------=_Part_337_1840082595.1498576634070
    Content-Type: text/plain; charset="ISO-8859-15"
    Content-Transfer-Encoding: quoted-printable

    Hello this is a testmail,

    ------=_Part_337_1840082595.1498576634070
    Content-Type: text/html; charset="ISO-8859-15"
    Content-Transfer-Encoding: quoted-printable

    <!DOCTYPE html><html><head></head>
        <body></body>
    </html>=

    ------=_Part_337_1840082595.1498576634070--

    ------=_Part_338_465097449.1498576634070
    Content-Type: application/octet-stream;
        name*0="1858289404-TEST ATTACH-TK-150-EIC-XX 123-TESTITITI_185828940";
        name*1="4_170627-1715_FS1.jpg"
    Content-Transfer-Encoding: base64
    Content-Dis
        filename*0="1858289404-TEST ATTACH-TK-150-EIC-XX 123-TESTITITI_185828940";
        filename*1="4_170627-1715_FS1.jpg"

    /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcG
    BwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwM
    DAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAcACMDASIA
    AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA
    AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3
    ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm
    p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA
    AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx
    BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK
    U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3
    uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDxnVNP
    SRIiI+cDOR+ld58NNWWCKAvHuRDtIVucdKy/7N/tKW1gCne/yj1Y1u6T4OufDmrSWU8LxuQHUMmN
    wr4D60muWTPqHQvqQ/C74TeLdXk8fanZ6BfXWkyLhbhQDlgwIx3NeU/Cf/gmjp/7Y2keJfGt1451
    Dw3cnX5dPubF9L83DRovzI+4ZGD6cYNfoj+zd4X0xP2fdWF7HqEN1dQyPFicC3mYdExxz6c56V4t
    /wAE9tJ1PUvg945P2S5K2vja/gbOGIOEODjuBj61fB2ZQxWbV6dSNlCmnfv71v0v8zs4hw0sLkE6
    tF3k5x6X3vf8GeKWf/BGXRrO2WL/AIWlrDbOMppKbT9MvRX2HPp1zDKVe0uFYdR5Tf4UV+me0oeR
    +Of2ji1pzfgfKmmA6XrVjdNx9nmV8r1OK9M+MPjn/hbfxF0270O1kyLNLYpHEd0khboP5V8G2/7e
    vxC1HQ7q4Nxo8Uka7l8vTYgAfyNVdO/4KffGd/D8V5b+JrbT7uBhGs1rpdtGxwcgn5CCR647Cvwd
    Vo1al1utPv8Amf0T/YlaELStrru+nyP0U8JeHdZ1zXta0TXtS1rwzq9rZnydOlDxRTNjIYoRjOOh
    HWuV/wCCNXhFNS8U/GOQ69fSeKotbdLvSze4trlAMG4EJ4MgxjcOcHBr43v/APgqT8fvjNrIl174
    larPLsjQyQ2dpAxEY2rykQ7Zz65r5R+Kf7QnjDwr8Z9bvrPW7mO6uboXUj4GWlxkv04P0rv4fVbC
    4+tKi0+aNtV05k/Mea5cqmVKjiHpOS21s1drV27H9Gumq+t2a3No63cDkhZY2yrEEq3T0IIPuDRX
    85mnf8FHfiroNmtpb61AIos7R9nA6kk9CB1Jor6tZjiFo6cfvf8Akfm8uFqV9Krt6L/M/9k=    

    ------=_Part_337_1840082595.1498576634070--

    Thursday, August 10, 2017 6:45 AM
  • Thanks for your information, for your question, it's recommended to post Exchange development forum for more professional assistance:

    https://social.technet.microsoft.com/Forums/exchange/en-US/home?forum=exchangesvrdevelopment


    Regards,

    Jason Chao


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Saturday, August 12, 2017 8:41 AM