This project is read-only.

"KeyNotFoundException was unhandled" for filename

Topics: Help requests
Dec 26, 2014 at 11:45 PM
Below, results of 2 Fetch commands issued to a Dovecot Imap Server
When using Inbox.Search("UNSEEN", ImapX.Enums.MessageFetchMode.Tiny, -1), it work fine on first message, but on second one I get "KeyNotFoundException was unhandled" on ContentDisposition.cs at line "get { return Parameters["filename"]; }"

In my application, I already created a work around to bypass exception. But would be fine to use MessageFetchMode.Tiny in a first round instead of MessageFetchMode.None then later check if there is an Exception.

Please pay attention to second message and look for differences.
By the way discard any format and read all as string, due to string "Attached file:" file name is presented with borders....

  • 2290 FETCH (BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "quo
    ted-printable" 60 0 NIL NIL NIL NIL)("application" "octet-stream" ("name" "35141
    .pdf") NIL NIL "base64" 47890 NIL NIL
    NIL NIL)("application" "octet-stream" ("name" "35141.xml") NIL NIL "base64" 11246 NIL NIL NIL NIL) "mixed" ("boundar
    y" "--boundary_21738_bff136bd-15e9-49f2-a17c-356f1354fe17") NIL NIL NIL))
    b1 OK Fetch completed.
  • 2289 FETCH (BODYSTRUCTURE (("text" "plain" ("charset" "ISO-8859-1") NIL "Messa
    ge text" "Quoted-printable" 198 4 NIL ("inline" NIL) NIL NIL)("application" "oct
    et-stream" ("name" "3514120.xml") N
    IL {72}
    Attached file:
           3514120.xml "Base64"
    10420 NIL ("attachment" ("FileName" "3514120.xml")) NIL NIL) "mixed" ("boundary" "6DB31F22_058D3956_Synapse_bounda
    ry") NIL NIL NIL))
    b2 OK Fetch completed.
Dec 28, 2014 at 2:15 PM
Some more info
Seems KeyNotfoundException is related to (my guess) capitalized string "FileName", since in MessageContent.cs consider it only in lower case.
In addition a body.peek tell me X-mailer: Synapse - Pascal TCP/IP library by Lukas Gebauer wich look a library for Delphi developers.