Archived Forum Post

Index of archived forum posts

Question:

SaveAllAttachments saves no attachment, GetMailAttachFilename returns null

Nov 23 '16 at 12:07

Can not get the attachment out of the email I can read the attachment from my email reader so I know that there is an attachment

This happens to at least 10 percent of emails with attachments

        Imap.KeepSessionLog = true;
        Imap.VerboseLogging = true;
        Imap.AutoDownloadAttachments = false;

int _numAttach = Imap.GetMailNumAttach(fullEmail);      //Returns 1
        int _attachSize = Imap.GetMailAttachSize(fullEmail, 0);     //Returns 169898
        string _fileName = Imap.GetMailAttachFilename(fullEmail, 0);    //Returns null

bool attachmentSuccess = fullEmail.SaveAllAttachments(_attachmentFolder);   //Returns true but no file name and no error
    bool success1 = Imap.FetchAttachment(fullEmail, 0, _attachmentFolder);      //Returns false 

If I change Imap.AutoDownloadAttachments = true; Imap.GetMailNumAttach(fullEmail) returns 0 With Imap.AutoDownloadAttachments = false I can at least call Imap.FetchAttachmentString and see the attachment.

With an email that works Imap.FetchAttachmentString it only gets the attachments with an email that does not work FetchAttachmentString returns this

From: <valid email="">
To: <valid email="">
Subject: Important Document(s) from REMOVED NAME
Date: Wed, 5 Oct 2016 18:25:35 -0400
MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="==U2FsYW1hdE9EaW9z-57f57ddf0000a595=="

--==U2FsYW1hdE9EaW9z-57f57ddf0000a595==
Content-Type: application/pdf; name="image2016-10-05-182534.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="image2016-10-05-182534.pdf"
Content-Description: image2016-10-05-182534.pdf

JVBERi0xLjUKJYCAgIAKMTEgMCBvYmoKPDwgL1R5cGUgL1BhZ2UKIC9QYXJlbnQgMyAwIFIK
L1Jlc291cmNlcyA8PCAvUHJvY1NldCBbL1BERiAvSW1hZ2VCIC9JbWFnZUMgL0ltYWdlSV0v

LOTS OF LINES REMOVED

byAxIDAgUgovUm9vdCAyIDAgUgovSUQgWyA8YzczNWQ0OWY2ZDNlN2ZkYWExNWZkODMxY2Mx
NmMwYjk+CjxjNzM1ZDQ5ZjZkM2U3ZmRhYTE1ZmQ4MzFjYzE2YzBiOT4gXQo+PgpzdGFydHhy
ZWYKMTIzMTEwCiUlRU9GCg==

--==U2FsYW1hdE9EaW9z-57f57ddf0000a595==--

with the following LastErrorText The folder does exist

ChilkatLog:
  FetchAttachment(328ms):
    DllDate: Sep 18 2016
    ChilkatVersion: 9.5.0.59
    UnlockPrefix: JHNSER.CB10917
    Architecture: Little Endian; 64-bit
    Language: .NET 4.6 / x64
    VerboseLogging: 1
    attachIndex: 0
    saveToPath: D:\Data\Attachments\3\inbox\89d53704-5a42-e226-a6b8-8f9d32421521\
    isExistingDirectory: 1
    uid: 136
    bIsUid: 1
    attachmentFilename: 
    attachmentMsgPart: 2
    attachmentEncoding: 7BIT
    attachmentSize: 169898
    fetchAttachment(328ms):
      fetchCommand: aaah UID FETCH 136 (BODY[2])
      ImapCmdSent: aaah UID FETCH 136 (BODY[2])
      sendCommand: Elapsed time: 0 millisec
      getFetchAttachmentResponse(328ms):
        getPartialResponse(125ms):
          stopString: BODY[
          sbLine: * 136 FETCH (UID 136 BODY[2] {169898}

ImapCmdResp: * 136 FETCH (UID 136 BODY[2] {169898}
          Found stop string.
        --getPartialResponse
        receiveImapBytes: Elapsed time: 203 millisec
        ImapCmdResp: (169898 bytes)
        finalParenLine: )

getPartialResponse:
          sbLine: aaah OK UID FETCH completed

Received complete response to final tag line.
          ImapCmdResp: aaah OK UID FETCH completed
        --getPartialResponse
        finalResponsePart: aaah OK UID FETCH completed

bReceivedToFinalTagLine: 1
        bOk: 1
        success: 1
      --getFetchAttachmentResponse
    --fetchAttachment
    decodedSize: 169898
    savingToFile: D:\Data\Attachments\3\inbox\89d53704-5a42-e226-a6b8-8f9d32421521\
    WindowsError: The system cannot find the path specified.
    WindowsErrorCode: 0x3
    win32CreateFileAnsi failed.
    localFilePath: D:\Data\Attachments\3\inbox\89d53704-5a42-e226-a6b8-8f9d32421521\
    currentWorkingDirectory: D:\Projects\SurgeOne\SurgeOne.EmailProcessor\SurgeOne.EmailProcessor\bin\Debug
    localWindowsFilePath: D:\Data\Attachments\3\inbox\89d53704-5a42-e226-a6b8-8f9d32421521\
    filename: D:\Data\Attachments\3\inbox\89d53704-5a42-e226-a6b8-8f9d32421521\
    Failed to write complete file (7)
    Failed.
  --FetchAttachment
--ChilkatLog

Other Last Error Text Messages Session Log

----IMAP REQUEST----
aaad UID FETCH 136 RFC822.SIZE
----IMAP RESPONSE----
* 136 FETCH (UID 136 RFC822.SIZE 176779)
aaad OK UID FETCH completed
----IMAP REQUEST----
aaae UID FETCH 136 (UID BODYSTRUCTURE)
----IMAP RESPONSE----
* 136 FETCH (UID 136 BODYSTRUCTURE ((("TEXT" "plain" ("charset" "US-ASCII") NIL NIL "7BIT" 1361 3 NIL ("inline" NIL) NIL NIL)("TEXT" "html" ("charset" "US-ASCII") NIL NIL "7BIT" 1413 9 NIL ("inline" NIL) NIL NIL) "alternative" ("boundary" "=====mte=boundary=number=1491=====") ("inline" NIL) NIL NIL)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 169898 ("Wed, 5 Oct 2016 18:25:35 -0400" "Important Document(s) from Lowe's" ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "daniel" "windorsolutions.com")) NIL NIL NIL NIL) (("APPLICATION" "pdf" ("name" "image2016-10-05-182534.pdf") NIL "image2016-10-05-182534.pdf" "BASE64" 169338 NIL ("attachment" ("filename" "image2016-10-05-182534.pdf")) NIL NIL) "mixed" ("boundary" "==U2FsYW1hdE9EaW9z-57f57ddf0000a595==") NIL NIL NIL) 2305 NIL ("attachment" NIL) NIL NIL) "mixed" ("boundary" "=====mte=boundary=number=1490=====") NIL NIL NIL))
aaae OK UID FETCH completed
----IMAP REQUEST----
aaaf UID FETCH 136 (FLAGS INTERNALDATE BODY[HEADER] BODY[1.MIME] BODY[1])
----IMAP RESPONSE----
* 136 FETCH (UID 136 INTERNALDATE "05-Oct-2016 22:25:41 +0000" FLAGS (\Seen) BODY[HEADER] {3464}
(3464 bytes)
 BODY[1.MIME] {115}
(115 bytes)
 BODY[1] {3115}
(3115 bytes)
)
aaaf OK UID FETCH completed
----IMAP REQUEST----
aaag UID FETCH 136 (BODY[2])
----IMAP RESPONSE----
* 136 FETCH (UID 136 BODY[2] {169898}
(169898 bytes)
aaag OK UID FETCH completed
----IMAP REQUEST----
aaah UID FETCH 136 (BODY[2])
----IMAP RESPONSE----
* 136 FETCH (UID 136 BODY[2] {169898}
(169898 bytes)
aaah OK UID FETCH completed
----IMAP REQUEST----
aaai UID FETCH 136 RFC822.SIZE
----IMAP RESPONSE----
* 136 FETCH (UID 136 RFC822.SIZE 176779)
aaai OK UID FETCH completed
----IMAP REQUEST----
aaaj UID FETCH 136 (UID BODYSTRUCTURE)
----IMAP RESPONSE----
* 136 FETCH (UID 136 BODYSTRUCTURE ((("TEXT" "plain" ("charset" "US-ASCII") NIL NIL "7BIT" 1361 3 NIL ("inline" NIL) NIL NIL)("TEXT" "html" ("charset" "US-ASCII") NIL NIL "7BIT" 1413 9 NIL ("inline" NIL) NIL NIL) "alternative" ("boundary" "=====mte=boundary=number=1491=====") ("inline" NIL) NIL NIL)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 169898 ("Wed, 5 Oct 2016 18:25:35 -0400" "Important Document(s) from Lowe's" ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "daniel" "windorsolutions.com")) NIL NIL NIL NIL) (("APPLICATION" "pdf" ("name" "image2016-10-05-182534.pdf") NIL "image2016-10-05-182534.pdf" "BASE64" 169338 NIL ("attachment" ("filename" "image2016-10-05-182534.pdf")) NIL NIL) "mixed" ("boundary" "==U2FsYW1hdE9EaW9z-57f57ddf0000a595==") NIL NIL NIL) 2305 NIL ("attachment" NIL) NIL NIL) "mixed" ("boundary" "=====mte=boundary=number=1490=====") NIL NIL NIL))
aaaj OK UID FETCH completed
----IMAP REQUEST----
aaak UID FETCH 136 (FLAGS INTERNALDATE BODY[HEADER] BODY[1.MIME] BODY[1])
----IMAP RESPONSE----
* 136 FETCH (UID 136 INTERNALDATE "05-Oct-2016 22:25:41 +0000" FLAGS (\Seen) BODY[HEADER] {3464}
(3464 bytes)
 BODY[1.MIME] {115}
(115 bytes)
 BODY[1] {3115}
(3115 bytes)
)
aaak OK UID FETCH completed

Answer

First check to see if the problem remains when using the latest version of Chilkat (v9.5.0.64).

If so, then I need two pieces of information:

1) The IMAP session log for the email fetched with AutoDownloadAttachments = false.

2) The verbose LastErrorText for the method call that fetches the email without attachments.


Answer

Also.. In this LastErrorText for the FetchAttachment method call:

ChilkatLog:
  FetchAttachment(328ms):
    DllDate: Sep 18 2016
    ChilkatVersion: 9.5.0.59
    UnlockPrefix: JHNSER.CB10917
    Architecture: Little Endian; 64-bit
    Language: .NET 4.6 / x64
    VerboseLogging: 1
    attachIndex: 0
    saveToPath: D:\Data\Attachments\3\inbox\89d53704-5a42-e226-a6b8-8f9d32421521\
    isExistingDirectory: 1
    uid: 136
    bIsUid: 1
    attachmentFilename: 
    attachmentMsgPart: 2
    attachmentEncoding: 7BIT

The "attachmentFilename" is empty. This means that either (1) no attachment filename was provided in the IMAP response when the email was fetched without headers, or (2) the attachment filename was present, but somehow it was not found when parsing the IMAP response.

If the IMAP server is not providing the attachment filename when downloading w/out attachments, then the app would need to specify a filename (somehow) or Chilkat would need to auto-generate a filename (probably not a good idea).


Answer

I am using the latest version of the application

Email that fails

Imap.SessionLog
----IMAP REQUEST----
aaad UID FETCH 136 RFC822.SIZE
----IMAP RESPONSE----
* 136 FETCH (UID 136 RFC822.SIZE 176779)
aaad OK UID FETCH completed
----IMAP REQUEST----
aaae UID FETCH 136 (UID BODYSTRUCTURE)
----IMAP RESPONSE----
* 136 FETCH (UID 136 BODYSTRUCTURE ((("TEXT" "plain" ("charset" "US-ASCII") NIL NIL "7BIT" 1361 3 NIL ("inline" NIL) NIL NIL)("TEXT" "html" ("charset" "US-ASCII") NIL NIL "7BIT" 1413 9 NIL ("inline" NIL) NIL NIL) "alternative" ("boundary" "=====mte=boundary=number=1491=====") ("inline" NIL) NIL NIL)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 169898 ("Wed, 5 Oct 2016 18:25:35 -0400" "Important Document(s) from Lowe's" ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "daniel" "windorsolutions.com")) NIL NIL NIL NIL) (("APPLICATION" "pdf" ("name" "image2016-10-05-182534.pdf") NIL "image2016-10-05-182534.pdf" "BASE64" 169338 NIL ("attachment" ("filename" "image2016-10-05-182534.pdf")) NIL NIL) "mixed" ("boundary" "==U2FsYW1hdE9EaW9z-57f57ddf0000a595==") NIL NIL NIL) 2305 NIL ("attachment" NIL) NIL NIL) "mixed" ("boundary" "=====mte=boundary=number=1490=====") NIL NIL NIL))
aaae OK UID FETCH completed
----IMAP REQUEST----
aaaf UID FETCH 136 (FLAGS INTERNALDATE BODY[HEADER] BODY[1.MIME] BODY[1])
----IMAP RESPONSE----
* 136 FETCH (UID 136 INTERNALDATE "05-Oct-2016 22:25:41 +0000" FLAGS (\Seen) BODY[HEADER] {3464}
(3464 bytes)
 BODY[1.MIME] {115}
(115 bytes)
 BODY[1] {3115}
(3115 bytes)
)
aaaf OK UID FETCH completed

int _numAttach = Imap.GetMailNumAttach(fullEmail);      //1
int _attachSize = Imap.GetMailAttachSize(fullEmail, 0);     //169898
string _fileName = Imap.GetMailAttachFilename(fullEmail, 0);    //null

If I call bool attachmentSuccess = fullEmail.SaveAllAttachments(_attachmentFolder); //Returns success -- but no file is saved

This is LastErrorText

ChilkatLog:
  GetMailAttachFilename:
    DllDate: Nov 12 2016
    ChilkatVersion: 9.5.0.64
    UnlockPrefix: JHNSER.CB10917
    Architecture: Little Endian; 64-bit
    Language: .NET 4.6 / x64
    VerboseLogging: 1
    ckx-imap-attach-nm-1 header is not present or empty
    index: 0
    Attachment index out of range.
    attachmentIndex: 0
    numAttachments: 0
    Failed.
  --GetMailAttachFilename
--ChilkatLog

If I call string _test = Imap.FetchAttachmentString(fullEmail, 0, "utf-8");

This is LastErrorText
ChilkatLog:
  FetchAttachmentString(312ms):
    DllDate: Nov 12 2016
    ChilkatVersion: 9.5.0.64
    UnlockPrefix: JHNSER.CB10917
    Architecture: Little Endian; 64-bit
    Language: .NET 4.6 / x64
    VerboseLogging: 1
    attachIndex: 0
    charset: utf-8
    uid: 136
    bIsUid: 1
    attachmentFilename: 
    attachmentMsgPart: 2
    attachmentEncoding: 7BIT
    attachmentSize: 169898
    fetchAttachment(312ms):
      fetchCommand: aaag UID FETCH 136 (BODY[2])
      ImapCmdSent: aaag UID FETCH 136 (BODY[2])
      sendCommand: Elapsed time: 0 millisec
      getFetchAttachmentResponse(312ms):
        getPartialResponse(140ms):
          stopString: BODY[
          sbLine: * 136 FETCH (UID 136 BODY[2] {169898}

ImapCmdResp: * 136 FETCH (UID 136 BODY[2] {169898}
          Found stop string.
        --getPartialResponse
        receiveImapBytes: Elapsed time: 172 millisec
        ImapCmdResp: (169898 bytes)
        finalParenLine: )

getPartialResponse:
          sbLine: aaag OK UID FETCH completed

Received complete response to final tag line.
          ImapCmdResp: aaag OK UID FETCH completed
        --getPartialResponse
        finalResponsePart: aaag OK UID FETCH completed

bReceivedToFinalTagLine: 1
        bOk: 1
        success: 1
      --getFetchAttachmentResponse
    --fetchAttachment
    decodedSize: 169898
    Success.
  --FetchAttachmentString
--ChilkatLog

This is returned by FetchAttachmentString

From: <donotreply@lowes.com>
To: <daniel@windorsolutions.com>
Subject: Important Document(s) from Lowe's
Date: Wed, 5 Oct 2016 18:25:35 -0400
MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="==U2FsYW1hdE9EaW9z-57f57ddf0000a595=="

--==U2FsYW1hdE9EaW9z-57f57ddf0000a595==
Content-Type: application/pdf; name="image2016-10-05-182534.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="image2016-10-05-182534.pdf"
Content-Description: image2016-10-05-182534.pdf

JVBERi0xLjUKJYCAgIAKMTEgMCBvYmoKPDwgL1R5cGUgL1BhZ2UKIC9QYXJlbnQgMyAwIFIK
L1Jlc291cmNlcyA8PCAvUHJvY1NldCBbL1BERiAvSW1hZ2VCIC9JbWFnZUMgL0ltYWdlSV0v
WE9iamVjdCA8PC9JMTMgMTMgMCBSPj4gPj4KL01lZGlhQm94IFswIDAgNjEyIDc5Ml0vUm90

CUT OUT A LOT OF LINES

IDAwMDAwIG4gCjAwMDAxMTM1MDAgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSAxNQovSW5m
byAxIDAgUgovUm9vdCAyIDAgUgovSUQgWyA8YzczNWQ0OWY2ZDNlN2ZkYWExNWZkODMxY2Mx
NmMwYjk+CjxjNzM1ZDQ5ZjZkM2U3ZmRhYTE1ZmQ4MzFjYzE2YzBiOT4gXQo+PgpzdGFydHhy
ZWYKMTIzMTEwCiUlRU9GCg==

--==U2FsYW1hdE9EaW9z-57f57ddf0000a595==--

Answer

Email that doesn't fail -- both emails are from the same sender, have the same subject same body and both contain a pdf document

Imap.SessionLog
----IMAP REQUEST----
aaad UID FETCH 135 RFC822.SIZE
----IMAP RESPONSE----
* 135 FETCH (UID 135 RFC822.SIZE 155924)
aaad OK UID FETCH completed
----IMAP REQUEST----
aaae UID FETCH 135 (UID BODYSTRUCTURE)
----IMAP RESPONSE----
* 135 FETCH (UID 135 BODYSTRUCTURE (("TEXT" "plain" ("charset" "UTF-8") NIL NIL "7BIT" 1393 4 NIL NIL NIL NIL)("APPLICATION" "pdf" ("name" "image2016-10-05-165244.pdf") NIL "image2016-10-05-165244.pdf" "BASE64" 150648 NIL ("attachment" ("filename" "image2016-10-05-165244.pdf")) NIL NIL) "mixed" ("boundary" "==U2FsYW1hdE9EaW9z-57f5762c00060dcf==") NIL NIL NIL))
aaae OK UID FETCH completed
----IMAP REQUEST----
aaaf UID FETCH 135 (FLAGS INTERNALDATE BODY[HEADER] BODY[1.MIME] BODY[1])
----IMAP RESPONSE----
* 135 FETCH (UID 135 INTERNALDATE "05-Oct-2016 21:52:53 +0000" FLAGS (\Seen) BODY[HEADER] {3485}
(3485 bytes)
 BODY[1.MIME] {45}
(45 bytes)
 BODY[1] {1393}
(1393 bytes)
)
aaaf OK UID FETCH completed

int _numAttach = Imap.GetMailNumAttach(fullEmail);      //1
int _attachSize = Imap.GetMailAttachSize(fullEmail, 0);     //150648
string _fileName = Imap.GetMailAttachFilename(fullEmail, 0);    //image2016-10-05-165244.pdf

If I call bool attachmentSuccess = fullEmail.SaveAllAttachments(_attachmentFolder); //Returns success -- file is saved to the harddrive

This is LastErrorText

ChilkatLog:
  GetMailAttachFilename:
    DllDate: Nov 12 2016
    ChilkatVersion: 9.5.0.64
    UnlockPrefix: JHNSER.CB10917
    Architecture: Little Endian; 64-bit
    Language: .NET 4.6 / x64
    VerboseLogging: 1
    Success.
  --GetMailAttachFilename
--ChilkatLog

If I call string _test = Imap.FetchAttachmentString(fullEmail, 0, "utf-8");

This is LastErrorText
ChilkatLog:
  FetchAttachmentString(360ms):
    DllDate: Nov 12 2016
    ChilkatVersion: 9.5.0.64
    UnlockPrefix: JHNSER.CB10917
    Architecture: Little Endian; 64-bit
    Language: .NET 4.6 / x64
    VerboseLogging: 1
    attachIndex: 0
    charset: utf-8
    uid: 135
    bIsUid: 1
    attachmentFilename: image2016-10-05-165244.pdf
    attachmentMsgPart: 2
    attachmentEncoding: BASE64
    attachmentSize: 150648
    fetchAttachment(360ms):
      fetchCommand: aaag UID FETCH 135 (BODY[2])
      ImapCmdSent: aaag UID FETCH 135 (BODY[2])
      sendCommand: Elapsed time: 0 millisec
      getFetchAttachmentResponse(360ms):
        getPartialResponse(172ms):
          stopString: BODY[
          sbLine: * 135 FETCH (UID 135 BODY[2] {150648}

ImapCmdResp: * 135 FETCH (UID 135 BODY[2] {150648}
          Found stop string.
        --getPartialResponse
        receiveImapBytes: Elapsed time: 188 millisec
        ImapCmdResp: (150648 bytes)
        finalParenLine: )

getPartialResponse:
          sbLine: aaag OK UID FETCH completed

Received complete response to final tag line.
          ImapCmdResp: aaag OK UID FETCH completed
        --getPartialResponse
        finalResponsePart: aaag OK UID FETCH completed

bReceivedToFinalTagLine: 1
        bOk: 1
        success: 1
      --getFetchAttachmentResponse
    --fetchAttachment
    decodedSize: 109932
    Success.
  --FetchAttachmentString
--ChilkatLog
This is returned by FetchAttachmentString

%PDF-1.5
%
11 0 obj
<< /Type /Page
 /Parent 3 0 R
/Resources << /ProcSet [/PDF /ImageB /ImageC /ImageI]/XObject <</i13>> >>
/MediaBox [0 0 612 792]/Rotate 0/Contents 12 0 R >>
endobj
12 0 obj
<< /Length 76
>>
stream
q
Q
q
W
0 0 m
612 0 l

Answer

Thanks! You provided a lot of information, except for the 2nd thing I requested:

2) The verbose LastErrorText for the method call that fetches the email without attachments.

The variable named "fullEmail" contains an email. I need the verbose LastErrorText for whichever Imap method call downloaded that email. You've been giving me all of the information relating to downloading attachments after the email (without attachments) was downloaded, but I want to see the LastErrorText for the downloading of the email itself.


Answer

This post contains two LastErrorText the first block is for an email that works the second block is for an email that does not work

Email from which I can extract an attachment with the SaveAllAttachments

ChilkatLog:
  FetchSingle(703ms):
    DllDate: Nov 12 2016
    ChilkatVersion: 9.5.0.64
    UnlockPrefix: JHNSER.CB10917
    Architecture: Little Endian; 64-bit
    Language: .NET 4.6 / x64
    VerboseLogging: 1
    msgId: 135
    bUid: 1
    autoDownloadAttachments: 0
    Getting message size for progress monitoring...
    ImapCmdSent: aaad UID FETCH 135 RFC822.SIZE
    getCompleteResponse(78ms):
      ImapCmdResp: * 135 FETCH (UID 135 RFC822.SIZE 155924)
      ImapCmdResp: aaad OK UID FETCH completed
    --getCompleteResponse
    totalSize: 155924
    totalSize: Elapsed time: 78 millisec
    fetchSingleEmailObject(625ms):
      msgId: 135
      isUid: 1
      fetchSingleComplete(625ms):
        autoDownloadAttachments: 0
        fetchComplete(625ms):
          autoDownloadAttachments: 0
          Fetching message summary. (UID BODYSTRUCTURE)
          fetchMsgSummary(359ms):
            fetchMultipleSummaries(359ms):
              ImapCmdSent: aaae UID FETCH 135 (UID BODYSTRUCTURE)
              getCompleteResponse2(359ms):
                ImapCmdResp: * 135 FETCH (UID 135 BODYSTRUCTURE (("TEXT" "plain" ("charset" "UTF-8") NIL NIL "7BIT" 1393 4 NIL NIL NIL NIL)("APPLICATION" "pdf" ("name" "image2016-10-05-165244.pdf") NIL "image2016-10-05-165244.pdf" "BASE64" 150648 NIL ("attachment" ("filename" "image2016-10-05-165244.pdf")) NIL NIL) "mixed" ("boundary" "==U2FsYW1hdE9EaW9z-57f5762c00060dcf==") NIL NIL NIL))
                ImapCmdResp: aaae OK UID FETCH completed
              --getCompleteResponse2
            --fetchMultipleSummaries
            isOK:
              serverResponse: aaae OK UID FETCH completed
            --isOK
            parseSummary:
              ----
              parseItem: UID
              uid: 135
              ----
              parseItem: BODYSTRUCTURE
              bodystructure1: (("TEXT" "plain" ("charset" "UTF-8") NIL NIL "7BIT" 1393 4 NIL NIL NIL NIL)("APPLICATION" "pdf" ("name" "image2016-10-05-165244.pdf") NIL "image2016-10-05-165244.pdf" "BASE64" 150648 NIL ("attachment" ("filename" "image2016-10-05-165244.pdf")) NIL NIL) "mixed" ("boundary" "==U2FsYW1hdE9EaW9z-57f5762c00060dcf==") NIL NIL NIL))
aaae OK UID FETCH completed

          parseBodyStructure:
            parseMultipartBody:
              parseBodyStructure:
                parseNonMultipartBody:
                  type: TEXT
                  subType: plain
                  captureParenList:
                    charset: UTF-8
                  --captureParenList
                  contentId: NIL
                  descrip: NIL
                  encoding: 7BIT
                  size: 1393
                  numTextLines: 4
                  MD5: NIL
                  part: 1
                  filename: 
                  filenameExact: 
                --parseNonMultipartBody
              --parseBodyStructure
              parseBodyStructure:
                parseNonMultipartBody:
                  type: APPLICATION
                  subType: pdf
                  captureParenList:
                    name: image2016-10-05-165244.pdf
                  --captureParenList
                  contentId: NIL
                  descrip: image2016-10-05-165244.pdf
                  encoding: BASE64
                  size: 150648
                  MD5: NIL
                  captureDisposition:
                    disposition: attachment
                    captureParenList:
                      filename: image2016-10-05-165244.pdf
                    --captureParenList
                  --captureDisposition
                  part: 2
                  filename: image2016-10-05-165244.pdf
                  filenameExact: image2016-10-05-165244.pdf
                --parseNonMultipartBody
              --parseBodyStructure
              multipartSubType: mixed
              checkSetAttachment:
                type: TEXT
                multipartParentType: mixed
                childIndex: 0
                disposition: 
                bPassedAlternative: 0
                bPassedRelated: 0
                Not considered an attachment.
              --checkSetAttachment
              checkSetAttachment:
                type: APPLICATION
                multipartParentType: mixed
                childIndex: 1
                disposition: attachment
                bPassedAlternative: 0
                bPassedRelated: 0
                Considered attachment because it is non-text under multipart/mixed.
              --checkSetAttachment
              imapAttachment:
                filename: image2016-10-05-165244.pdf
                msgPart: 2
                attachmentSize: 150648
                encoding: BASE64
              --imapAttachment
            --parseMultipartBody
          --parseBodyStructure
        --parseSummary
      --fetchMsgSummary
      numAttachmentsFromMsgSummary: 1
      ImapMsgParts:
        multipart/mixed ()
        TEXT/plain (1)
        APPLICATION/pdf (2)
      --ImapMsgParts
      fetchCompleteWithoutAttachments(266ms):
        fetchCommand: aaaf UID FETCH 135 (FLAGS INTERNALDATE BODY[HEADER] BODY[1.MIME] BODY[1])
        ImapCmdSent: aaaf UID FETCH 135 (FLAGS INTERNALDATE BODY[HEADER] BODY[1.MIME] BODY[1])
        sendCommand: Elapsed time: 16 millisec
        getCompleteFetchResponse2(250ms):
          getPartialResponse(172ms):
            stopString: BODY[HEADER]
            sbLine: * 135 FETCH (UID 135 INTERNALDATE "05-Oct-2016 21:52:53 +0000" FLAGS (\Seen) BODY[HEADER] {3485}

            ImapCmdResp: * 135 FETCH (UID 135 INTERNALDATE "05-Oct-2016 21:52:53 +0000" FLAGS (\Seen) BODY[HEADER] {3485}
            Found stop string.
          --getPartialResponse
          flagsAndSizeData: * 135 FETCH (UID 135 INTERNALDATE "05-Oct-2016 21:52:53 +0000" FLAGS (\Seen) BODY[HEADER] {3485}
          flags: \Seen
          imapTopHeaderSize: 3485
          receiveImapBytes: Elapsed time: 0 millisec
          ImapCmdResp: (3485 bytes)
          sbTopHeader:
            --------------------------------------------------
            sbTopHeader: Return-Path: <LexPrin@lowes.com>

Received: from LXVPMSGBM21.LOWES.COM ([168.244.164.170]) by mx.perfora.net (mxeueus002) with ESMTPS (Nemesis) id 0LiVmE-1bJwsa2raG-00cfZw for <daniel@windorsolutions.com>; Wed, 05 Oct 2016 23:52:52 +0200 X-AuditID: ac14d41f-9dff3980000055ab-63-57f576336e4b Received: from msmsgex10wprd02.lowes.com (msmsgex10wprd02.lowes.com [172.26.122.12]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (SMTP Banner) with SMTP id CA.D0.21931.33675F75; Wed, 5 Oct 2016 17:52:51 -0400 (EDT) Received: from isoprt75.2851.lowes.com (172.26.202.27) by MSMSGEX10WPRD02.lowes.com (172.26.122.12) with Microsoft SMTP Server id 14.3.301.0; Wed, 5 Oct 2016 17:52:44 -0400 To: <daniel@windorsolutions.com> From: <DoNotReply@lowes.com> Date: Wed, 5 Oct 2016 16:52:44 -0500 Subject: Important Document(s) from Lowe's X-Mailer: Lexmark MX611de Message-ID: <1475704364.268987.67680@isoprt75.2851.lowes.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="==U2FsYW1hdE9EaW9z-57f5762c00060dcf==" X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEIsWRmVeSWpSXmKPExsWyRqqKR9e47Gu4wdHfUhbf771ndWD06Lx1 lS2AMaqB0SYxLy+/JLEkVSEltTjZVskvtVzBJbM4OScxMze1qFhXwchIIas0p1LByMDQWEkh M8VWyVRJoSAnMTk1NzWvxFYpsaAgNS9FyY5LAQPYAJVl5imk5iXnp2TmpdsqeQb761pYmFrq GirZ+fmHeDq7WiU0SGS8PDuFtWDRHM6KDTs2sDQwzvjD0cXIySEhYCLxf/lMpi5GLg4hgWlM Em8WT4VyNjBKHJ/1g72LkYNDREBBoveoA0gDm4CMRPPKCewgNouAisS9cxMYQWxhAS2Jy9Ou s0EMlZToPtcCVsMrYCvR3rGPEcIWlDg58wkLiM0sECjx9v0tJhBbSEBRouvaRvYJjDyzkJTN QlIGYWtKtG7/zQ5hO0jsXX+dGcJWlJjS/RAozgFku0k0vZCBCOtLzDqyknEBI/sqRtGcirKC 3OL0pFwjQ72c/PLUYr3k/NxNjKCoE7kiv4Oxq8XpEKMAB6MSDy+r+tdwIdbEsuLK3EOMpkBf TmSWEk3OB8Z2Xkm8oaGliZGlmbG5pamhiZI4b0r3u3AhgXRg3GanphakFsUXleakFh9iZOLg lGpgdPxfb9mf7bBZeM/SdTdz5ug8WKr+bNKW8x7vApxZlcQWHLl7i/9WZo6UYsCzWs1UiRdO DS669Ud1X3E5VK9O2xzx6FFmr8O2rjPr1/9h7W+KjLq7eW/9soOmPz4JNzbP4Vz5RqFTSYq1 ObtTtZZHnU/BtuJGK/tr7uV31nA7cTVUZaX+1mVTYinOSDTUYi4qTgQAbGTV+bUCAAA= Envelope-To: <daniel@windorsolutions.com> X-UI-Filterresults: notjunk:1;V01:K0:39dQJ8pIt5U=:HMKAuQfK7QTx4JVZpOgKQ1GFkW 0ajKyH38fIJ25WaePzm48Lpmo+aROzOBWsSAN4+A7Yf9V/jU2PcnRT4W3hRsdxQn+Z3a2o+0h QdvmXqfvkLP6rZFalqHxIjgi4/O6dL6Wl+tPR7OtYRznYUddV6YlDFamgNBTdiX8mgsayZGZO MI/96ZlINCJ+yQYx/YcoMVm5jfWywNVXnxvYLFkFZk9X6+1IWgvk+BR5BWPB/ImLgKy8cuDl/ X6Cuv3xR/QePkqQJNJC40N6v4JKVtSabyk7yFD5/5+lY0UsFxxl8zXCD3shqvfsNoSePw/kQf Bd/EKfnnkEphowCVvtmHMTiohV5l396wzeE/DJGs9WuqSSO52qM6WB3EweQOVzEBXokldZjDr 5UYGIZ1w7O3Hmb+iSKuynutwQ3Xad+IWe4Sf0DtuvBx84pgDktEku5288uvheqBw6rGO1zahf D3ubBzaTNrBNJJsuQLq7CR66RcouQ6MRrJ1MOrUlFEBqgojTaPEJdELuN2WcsAWpL2cAZEPMA 1Y62sRCqAStzweFwRz2xDY/lBct7eRtyCuECvun7qjbkuY2BD3NZLz8Zu2Q5d6KYSAFhrdVLP WX1TUTlBRy3vac6qnEOZL+Ej+NjJk9ns574XqPwMQX2aVHEb6RaOEvtcMZ3kdT7q9E4rKIUU/ IQJ5ehKG7mUD5BcZVDDFcBuF3DKrlf3We6IaTFL1p+nZAZvyGlg9tSwmdkIVROq0aGCJLXZ80 W2F5khIADfFwx4uHy93z4deq0VB7COiDJYbabzshfETNvWpTIaYpuXa2iWHSsWQ3yxk6VfjhF /7+kpyedkH+89tv8b5tL+6guNxFA8SU6bRAqE/C06R4dVj2OqIMXwdlSYgMed76MPDCHn4P5v 3UjKQlHr40kXT8Tzzx7ZZUbytO1e7AkuQqyHfHdGFj79HSb4CyvUf04HlKVCREnNgCnZEQmFB sQGz9LiNQ1AoLChnnoUjUZ1E5qiDCFQtaXNQ7EXHqSByETKvy8eMu2abcX9mz0+mRjezmYyeE 9yQgalnj2M3z58UsBofzhYfKQ8VCHMNBHCPeTQ6mBqhSUCVnzLrl1e1HLhwpd6SpJDS66IOJH QlLVCBBDZm74Z3aa4DJg8l11ZibpRmCQgeHehBX0+HLXHfeZF44RNj9Meriyhx2DZD6kSaIVo 4dwfgf9aG+2cdMpVsDRK104MNhN43IPwJEJVN7ZvJiLxI9FBVCNXdt6rCSzoWCCQIFyqUn6PF HizMvh+scd0wY9w0PVx8yPjnDLM4257Y22yCGfIe7AZGImBzcSHG/YGo=

            --------------------------------------------------
          --sbTopHeader
          nextResponseLine:
            ImapCmdResp: BODY[1.MIME] {45}
            Checking for body...
            sbNextLine:  BODY[1.MIME] {45}

            partSize: 45
            receiveImapBytes: Elapsed time: 0 millisec
            ImapCmdResp: (45 bytes)
          --nextResponseLine
          nextResponseLine:
            ImapCmdResp: BODY[1] {1393}
            Checking for body...
            sbNextLine:  BODY[1] {1393}

            partSize: 1393
            receiveImapBytes: Elapsed time: 0 millisec
            ImapCmdResp: (1393 bytes)
          --nextResponseLine
          receiveFinalParenLine:
            finalParenLine: )

            ImapCmdResp: )
          --receiveFinalParenLine
          getPartialResponse(78ms):
            sbLine: aaaf OK UID FETCH completed

            Received complete response to final tag line.
            ImapCmdResp: aaaf OK UID FETCH completed
          --getPartialResponse
          finalResponsePart: aaaf OK UID FETCH completed

          bReceivedToFinalTagLine: 1
          bOk: 1
          success: 1
        --getCompleteFetchResponse2
      --fetchCompleteWithoutAttachments
    --fetchComplete
  --fetchSingleComplete
  ckx-imap-internaldate: 05-Oct-2016 21:52:53 +0000
  ckx-imap-uid: 135
  ckx-imap-isUid: YES
  ckx-imap-numAttach: 1
  attachmentInfo:
    ckx-imap-attach-nm-1: image2016-10-05-165244.pdf
    ckx-imap-attach-sz-1: 150648
    ckx-imap-attach-pt-1: 2
    ckx-imap-attach-enc-1: BASE64
  --attachmentInfo
  parseMime: Elapsed time: 0 millisec
--fetchSingleEmailObject
Success.

--FetchSingle --ChilkatLog

Email from which I can not extract an attachment with the SaveAllAttachments, but can still get the attachment via the FetchAttachmentString

ChilkatLog:
  FetchSingle(468ms):
    DllDate: Nov 12 2016
    ChilkatVersion: 9.5.0.64
    UnlockPrefix: JHNSER.CB10917
    Architecture: Little Endian; 64-bit
    Language: .NET 4.6 / x64
    VerboseLogging: 1
    msgId: 136
    bUid: 1
    autoDownloadAttachments: 0
    Getting message size for progress monitoring...
    ImapCmdSent: aaad UID FETCH 136 RFC822.SIZE
    getCompleteResponse(109ms):
      ImapCmdResp: * 136 FETCH (UID 136 RFC822.SIZE 176779)
      ImapCmdResp: aaad OK UID FETCH completed
    --getCompleteResponse
    totalSize: 176779
    totalSize: Elapsed time: 109 millisec
    fetchSingleEmailObject(359ms):
      msgId: 136
      isUid: 1
      fetchSingleComplete(359ms):
        autoDownloadAttachments: 0
        fetchComplete(359ms):
          autoDownloadAttachments: 0
          Fetching message summary. (UID BODYSTRUCTURE)
          fetchMsgSummary(203ms):
            fetchMultipleSummaries(203ms):
              ImapCmdSent: aaae UID FETCH 136 (UID BODYSTRUCTURE)
              getCompleteResponse2(203ms):
                ImapCmdResp: * 136 FETCH (UID 136 BODYSTRUCTURE ((("TEXT" "plain" ("charset" "US-ASCII") NIL NIL "7BIT" 1361 3 NIL ("inline" NIL) NIL NIL)("TEXT" "html" ("charset" "US-ASCII") NIL NIL "7BIT" 1413 9 NIL ("inline" NIL) NIL NIL) "alternative" ("boundary" "=====mte=boundary=number=1491=====") ("inline" NIL) NIL NIL)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 169898 ("Wed, 5 Oct 2016 18:25:35 -0400" "Important Document(s) from Lowe's" ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "daniel" "windorsolutions.com")) NIL NIL NIL NIL) (("APPLICATION" "pdf" ("name" "image2016-10-05-182534.pdf") NIL "image2016-10-05-182534.pdf" "BASE64" 169338 NIL ("attachment" ("filename" "image2016-10-05-182534.pdf")) NIL NIL) "mixed" ("boundary" "==U2FsYW1hdE9EaW9z-57f57ddf0000a595==") NIL NIL NIL) 2305 NIL ("attachment" NIL) NIL NIL) "mixed" ("boundary" "=====mte=boundary=number=1490=====") NIL NIL NIL))
                ImapCmdResp: aaae OK UID FETCH completed
              --getCompleteResponse2
            --fetchMultipleSummaries
            isOK:
              serverResponse: aaae OK UID FETCH completed
            --isOK
            parseSummary:
              ----
              parseItem: UID
              uid: 136
              ----
              parseItem: BODYSTRUCTURE
              bodystructure1: ((("TEXT" "plain" ("charset" "US-ASCII") NIL NIL "7BIT" 1361 3 NIL ("inline" NIL) NIL NIL)("TEXT" "html" ("charset" "US-ASCII") NIL NIL "7BIT" 1413 9 NIL ("inline" NIL) NIL NIL) "alternative" ("boundary" "=====mte=boundary=number=1491=====") ("inline" NIL) NIL NIL)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 169898 ("Wed, 5 Oct 2016 18:25:35 -0400" "Important Document(s) from Lowe's" ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "DoNotReply" "lowes.com")) ((NIL NIL "daniel" "windorsolutions.com")) NIL NIL NIL NIL) (("APPLICATION" "pdf" ("name" "image2016-10-05-182534.pdf") NIL "image2016-10-05-182534.pdf" "BASE64" 169338 NIL ("attachment" ("filename" "image2016-10-05-182534.pdf")) NIL NIL) "mixed" ("boundary" "==U2FsYW1hdE9EaW9z-57f57ddf0000a595==") NIL NIL NIL) 2305 NIL ("attachment" NIL) NIL NIL) "mixed" ("boundary" "=====mte=boundary=number=1490=====") NIL NIL NIL))
aaae OK UID FETCH completed

parseBodyStructure:
                parseMultipartBody:
                  parseBodyStructure:
                    parseMultipartBody:
                      parseBodyStructure:
                        parseNonMultipartBody:
                          type: TEXT
                          subType: plain
                          captureParenList:
                            charset: US-ASCII
                          --captureParenList
                          contentId: NIL
                          descrip: NIL
                          encoding: 7BIT
                          size: 1361
                          numTextLines: 3
                          MD5: NIL
                          captureDisposition:
                            disposition: inline
                          --captureDisposition
                          part: 1.1
                          filename: 
                          filenameExact: 
                        --parseNonMultipartBody
                      --parseBodyStructure
                      parseBodyStructure:
                        parseNonMultipartBody:
                          type: TEXT
                          subType: html
                          captureParenList:
                            charset: US-ASCII
                          --captureParenList
                          contentId: NIL
                          descrip: NIL
                          encoding: 7BIT
                          size: 1413
                          numTextLines: 9
                          MD5: NIL
                          captureDisposition:
                            disposition: inline
                          --captureDisposition
                          part: 1.2
                          filename: 
                          filenameExact: 
                        --parseNonMultipartBody
                      --parseBodyStructure
                      multipartSubType: alternative
                      checkSetAttachment:
                        type: TEXT
                        multipartParentType: alternative
                        childIndex: 0
                        disposition: inline
                        bPassedAlternative: 0
                        bPassedRelated: 0
                        Not considered an attachment.
                      --checkSetAttachment
                      checkSetAttachment:
                        type: TEXT
                        multipartParentType: alternative
                        childIndex: 1
                        disposition: inline
                        bPassedAlternative: 0
                        bPassedRelated: 0
                        Not considered an attachment.
                      --checkSetAttachment
                    --parseMultipartBody
                  --parseBodyStructure
                  parseBodyStructure:
                    parseNonMultipartBody:
                      type: MESSAGE
                      subType: RFC822
                      contentId: NIL
                      descrip: NIL
                      encoding: 7BIT
                      size: 169898
                      discardEnvelope:
                        dateTime: Wed, 5 Oct 2016 18:25:35 -0400
                        subject: Important Document(s) from Lowe's
                        addressStructList:
                          addressStruct:
                            pname: NIL
                            atDomainList: NIL
                            mailboxName: DoNotReply
                            hostName: lowes.com
                          --addressStruct
                        --addressStructList
                        addressStructList:
                          addressStruct:
                            pname: NIL
                            atDomainList: NIL
                            mailboxName: DoNotReply
                            hostName: lowes.com
                          --addressStruct
                        --addressStructList
                        addressStructList:
                          addressStruct:
                            pname: NIL
                            atDomainList: NIL
                            mailboxName: DoNotReply
                            hostName: lowes.com
                          --addressStruct
                        --addressStructList
                        addressStructList:
                          addressStruct:
                            pname: NIL
                            atDomainList: NIL
                            mailboxName: daniel
                            hostName: windorsolutions.com
                          --addressStruct
                        --addressStructList
                        addressStructList:
                          NIL
                        --addressStructList
                        addressStructList:
                          NIL
                        --addressStructList
                        inReplyTo: NIL
                        messageId: NIL
                      --discardEnvelope
                      embeddedMessageBodyStruct:
                        parseBodyStructure:
                          parseMultipartBody:
                            parseBodyStructure:
                              parseNonMultipartBody:
                                type: APPLICATION
                                subType: pdf
                                captureParenList:
                                  name: image2016-10-05-182534.pdf
                                --captureParenList
                                contentId: NIL
                                descrip: image2016-10-05-182534.pdf
                                encoding: BASE64
                                size: 169338
                                MD5: NIL
                                captureDisposition:
                                  disposition: attachment
                                  captureParenList:
                                    filename: image2016-10-05-182534.pdf
                                  --captureParenList
                                --captureDisposition
                                part: 1
                                filename: image2016-10-05-182534.pdf
                                filenameExact: image2016-10-05-182534.pdf
                              --parseNonMultipartBody
                            --parseBodyStructure
                            multipartSubType: mixed
                            checkSetAttachment:
                              type: APPLICATION
                              multipartParentType: mixed
                              childIndex: 0
                              disposition: attachment
                              bPassedAlternative: 0
                              bPassedRelated: 0
                              Considered attachment because it is non-text under multipart/mixed.
                            --checkSetAttachment
                            imapAttachment:
                              filename: image2016-10-05-182534.pdf
                              msgPart: 1
                              attachmentSize: 169338
                              encoding: BASE64
                            --imapAttachment
                          --parseMultipartBody
                        --parseBodyStructure
                      --embeddedMessageBodyStruct
                      numRfc822Lines: 2305
                      MD5: NIL
                      captureDisposition:
                        disposition: attachment
                      --captureDisposition
                      part: 2
                      filename: 
                      filenameExact: 
                    --parseNonMultipartBody
                  --parseBodyStructure
                  multipartSubType: mixed
                  checkSetAttachment:
                    type: MESSAGE
                    multipartParentType: mixed
                    childIndex: 1
                    disposition: attachment
                    bPassedAlternative: 1
                    bPassedRelated: 0
                    Considered attachment because child of multipart/mixed following multipart/alternative or multipart/related.
                  --checkSetAttachment
                  imapAttachment:
                    filename: 
                    msgPart: 2
                    attachmentSize: 169898
                    encoding: 7BIT
                  --imapAttachment
                --parseMultipartBody
              --parseBodyStructure
            --parseSummary
          --fetchMsgSummary
          numAttachmentsFromMsgSummary: 1
          ImapMsgParts:
            multipart/mixed ()
            multipart/alternative (1)
            TEXT/plain (1.1)
            TEXT/html (1.2)
            MESSAGE/RFC822 (2)
          --ImapMsgParts
          fetchCompleteWithoutAttachments(156ms):
            fetchCommand: aaaf UID FETCH 136 (FLAGS INTERNALDATE BODY[HEADER] BODY[1.MIME] BODY[1])
            ImapCmdSent: aaaf UID FETCH 136 (FLAGS INTERNALDATE BODY[HEADER] BODY[1.MIME] BODY[1])
            sendCommand: Elapsed time: 0 millisec
            getCompleteFetchResponse2(156ms):
              getPartialResponse(94ms):
                stopString: BODY[HEADER]
                sbLine: * 136 FETCH (UID 136 INTERNALDATE "05-Oct-2016 22:25:41 +0000" FLAGS (\Seen) BODY[HEADER] {3464}

ImapCmdResp: * 136 FETCH (UID 136 INTERNALDATE "05-Oct-2016 22:25:41 +0000" FLAGS (\Seen) BODY[HEADER] {3464}
                Found stop string.
              --getPartialResponse
              flagsAndSizeData: * 136 FETCH (UID 136 INTERNALDATE "05-Oct-2016 22:25:41 +0000" FLAGS (\Seen) BODY[HEADER] {3464}
              flags: \Seen
              imapTopHeaderSize: 3464
              receiveImapBytes: Elapsed time: 0 millisec
              ImapCmdResp: (3464 bytes)
              sbTopHeader:
                --------------------------------------------------
                sbTopHeader: Return-Path: <lexprin@lowes.com>
Received: from LXVPMSGBM23.LOWES.COM ([168.244.164.172]) by mx.perfora.net
 (mxeueus004) with ESMTPS (Nemesis) id 0LnRFo-1bG4eA3gnm-00hepS for
 <daniel@windorsolutions.com>; Thu, 06 Oct 2016 00:25:41 +0200
X-AuditID: ac14d421-95cfd98000005d41-da-57f57de39bf2
Received: from MSMSGEX10WPRD04.lowes.com (msmsgex10wprd04.lowes.com [172.26.122.14])
    (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits))
    (Client did not present a certificate)
    by  (SMTP Banner) with SMTP id D2.16.23873.3ED75F75; Wed,  5 Oct 2016 18:25:39 -0400 (EDT)
Received: from isoprt75.0532.lowes.com (172.26.202.27) by
 MSMSGEX10WPRD04.lowes.com (172.26.122.14) with Microsoft SMTP Server id
 14.3.301.0; Wed, 5 Oct 2016 18:25:35 -0400
To: <daniel@windorsolutions.com>
From: <donotreply@lowes.com>
Date: Wed, 5 Oct 2016 18:25:35 -0400
Subject: Important Document(s) from Lowe's
X-Mailer: Lexmark MX611de
Message-ID: <1475706334.923020.72116@isoprt75.0532.lowes.com>
MIME-Version: 1.0
content-type: multipart/mixed; boundary="=====mte=boundary=number=1490====="
X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKIsWRmVeSWpSXmKPExsWyRqqKT/dx7ddwg12d5hbf771ndWD06Lx1
    lS2AMaqB0SYxLy+/JLEkVSEltTjZVskvtVzBJbM4OScxMze1qFhXwchIIas0p1LByMDQWEkh
    M8VWyVRJoSAnMTk1NzWvxFYpsaAgNS9FyY5LAQPYAJVl5imk5iXnp2TmpdsqeQb761pYmFrq
    GirZ+fmHeDq7WiU0SGR8n/GDsWDDWq6Ko1+XsTcw7ujk6mLk5JAQMJFontnM1sXIxSEkMI1J
    4tvsFihnA6PEkme9LF2MHBwiAgoSvUcdQBrYBGQkmldOYAexWQRUJDo+L2ECsYUFtCQuT7vO
    BjFUUqL7XAtYDa+ArcSXj/uhbEGJkzOfgI1kFgiUOLXWECQsJKAo0XVtI/sERp5ZSKpmIVSB
    hJkFHCR+n7/ACGErSkzpfsgOYbtJPP13DsrWl7h/dwvjAka2VYyiORVlBbnF6Um5RsZ6Ofnl
    qcV6yfm5mxhBsSVyRXEH44wWp0OMAhyMSjy8LOpfw4VYE8uKK3MPMZoCPTaRWUo0OR8YwXkl
    8YaGliZGlmbG5pamhiZK4rwp3e/ChQTSgdGZnZpakFoUX1Sak1p8iJGJg1OqgTHpqrLBaxlh
    j5t3/3GfvPhQS4fP8eLe6QpcZw31Ux33qx7Wn247Qy54ey27250eGZYfrXvmpZ7Y+js3I9PM
    /pbY+V+8LtrXsy4daTyr5nH58vkD+nODFktE6bTtl9Ly5+jrbpsc+ebr9gjex62bt1byPEw1
    s1mq3lgbvON8sVjSsvr6Zr0yNiWW4oxEQy3mouJEANxVy16oAgAA
Envelope-To: <daniel@windorsolutions.com>
X-UI-Filterresults: notjunk:1;V01:K0:zrCd/m5D5Ac=:DeT4PobWH7tEPqFFKCmKKcrwdq
 mzg3t/C3PHQPecAh8+fRJlXl4mvYnIRDaSy+p+sUuJR95i2zPmNgkB6BbXsC91eM9bQNNCPP/
 BG/BqNtZ7zKF3jCoFTTWlr2nEfEXDiOHjNhzljOtRM2xtDw/DJFjAmGKiJB/AHw33e36cSI48
 JdEmoid5EuXz5NV4tXWQ4CPrXy0RJVJ97IhT+pRWjI+prpXiW9MpUACjXHSnPV/cuMQetV4/B
 veW41+FKTBq9laK0qo81uXeEonQzc0qaBAQlMMe/w4JnZoA1FfrIZ6wVeTxrn34+kz2fSgOyi
 xnfcFF/y+JMRUsFHkLohli8od2H+reiRMc6lI32BBwoTIqqrEvwC1hiws42A1phgysjHo0CfN
 RFvLQL50Ycaue5ufsA1dIq9ymYAMbvDp0Ryk1ZbwowXAESFmXS9LhCY+ZZxK5b5ji7yxWcH6n
 DieARoUl2nHfie+cit2SOjvaABmr7/vuAFlvPyLsmlapd3OHeeuc5AHyq02ya7Dalra9AF0Nc
 TgPpdO5v6z+x7QohCWIkALPYNJypre5mKMPmRQCOhHnr/DFmTII30xCkuNj+eHG2dA+KRhwnK
 DXX2mEAwOgpxykbsyHFmIBab6P5DEY1ufHklmwhcv/00mgfb6Pm76SZa2a9qyN6MsClj4Adnj
 YX76oz2MfI6XRQn65ilOZ/UafAw7CVKoRcG9UJ2+jqztI4b4ZNqSfLnoZjPs7yc083rIPIaQh
 NSn0wYlkyeDLGTm0LbZ7I5eKmTcDJp8wu3DjpV9OPjhV/pT7yAUFkMSTWD3FL8pvDawG1T9AO
 i4F++Q1PVMRB7eb2KkN77ODKU5uvqD3VZs4++cKSWYzGENis49hDpKgcYAuW1fEObdlvcviq7
 cDs8rF4eA8/18UdPOcpGHv+9/9Qj52YHL/az9W+8v5foGtboGm4n1BgZFqU7Xv9/j5Xn+GMzV
 Dhi2tWcyR89XK1lu5V7q/C0VQLp3Q+UkqNCgGRT66Tqib7fkyJiKt4DpSaw4EZ1II1ZPql8/C
 xSRYupi2Yzat/c59ATFYfsk2xNiA9Z1jJEIq4D1/r+eTCyWmqMpVg+mwnxVllHIKp/fMgeNK6
 HrwOk5T3ntGUYTP1EQYFsxk+cuPks4hbdj46R7lA/CuUfnG39K7Di/Yv1tiCambgdMmY7aeqE
 PQoYHaAD0vXPXIA4kA5vT2rUecDh2WHPyH10U99/j2Qmm9WleAZN+xtkOZeWZ6xlSUsw1Bp9M
 TOhYBgGN2SV1vjVkl7usX2HXmYB3N1jB2IsfeMZWcsZ8jM02PMQ31dQI=

--------------------------------------------------
              --sbTopHeader
              nextResponseLine:
                ImapCmdResp: BODY[1.MIME] {115}
                Checking for body...
                sbNextLine:  BODY[1.MIME] {115}

partSize: 115
                receiveImapBytes: Elapsed time: 0 millisec
                ImapCmdResp: (115 bytes)
              --nextResponseLine
              nextResponseLine:
                ImapCmdResp: BODY[1] {3115}
                Checking for body...
                sbNextLine:  BODY[1] {3115}

partSize: 3115
                receiveImapBytes: Elapsed time: 0 millisec
                ImapCmdResp: (3115 bytes)
              --nextResponseLine
              receiveFinalParenLine:
                finalParenLine: )

ImapCmdResp: )
              --receiveFinalParenLine
              getPartialResponse(62ms):
                sbLine: aaaf OK UID FETCH completed

Received complete response to final tag line.
                ImapCmdResp: aaaf OK UID FETCH completed
              --getPartialResponse
              finalResponsePart: aaaf OK UID FETCH completed

bReceivedToFinalTagLine: 1
              bOk: 1
              success: 1
            --getCompleteFetchResponse2
          --fetchCompleteWithoutAttachments
        --fetchComplete
      --fetchSingleComplete
      ckx-imap-internaldate: 05-Oct-2016 22:25:41 +0000
      ckx-imap-uid: 136
      ckx-imap-isUid: YES
      ckx-imap-numAttach: 1
      attachmentInfo:
        ckx-imap-attach-nm-1: 
        ckx-imap-attach-sz-1: 169898
        ckx-imap-attach-pt-1: 2
        ckx-imap-attach-enc-1: 7BIT
      --attachmentInfo
      parseMime: Elapsed time: 0 millisec
    --fetchSingleEmailObject
    Success.
  --FetchSingle
--ChilkatLog


Answer

I understand the problem. The emails that have problems are because the "attachments" are really attachments within an attached email. In other words, the email itself has no direct attachments.

The email has an attached message, and the attached message contains within it a PDF attachment.

Normally, an email that has an attached message is such that the attached message is opaque. In other words, to get at the attachments contained within the attached messages, you would first get the attached email object via the GetAttachedMessage method. The Email object returned by GetAttachedMessage would contain the expected attachments.

For example, if you downloaded the full email, you would be surprised to see that it has no attachments. This is correct because it has an attached message, and within it are the attachments.

The difficulty is this: With the IMAP protocol, it would be good to download the email w/out the bulk data (i.e. without attachments) so we can see what's there and then pick-and-choose what to download. If the download-without-attachments indicates N attachments, but the download-full-email indicates no attachments, then people will be confused. I think at this point we'll just have to document the behavior...

The problem here is that Chilkat sees the attachments within the attached message, but is somehow not parsing the name/filename. Therefore, when you try to save the attachment to a file, there is no filename and it fails. (Getting as a string succeeds because the filename is not needed for it.) I'll see what I can do to fix it..


Answer

I don't need a "smooth" solution but I do need a reliable solution.

E.g. if there is a way to check whether it is an attached document or an attached message and than process the message accordingly would be sufficient.

At the moment this is how I am dealing with it. I feel that checking for a missing file name is not a very robust way to determine how to process the attachments.

              for (int _iAttachment = 0; _iAttachment < _numAttachments; _iAttachment++)
              {
                string _fileName = Imap.GetMailAttachFilename(_email, _iAttachment);

//There are two flows here -- emails that work and emails that do not work
                if (_fileName == null)
                {
                  byte[] _attachmentContent = Imap.FetchAttachmentBytes(_email, _iAttachment);

//MimeMessage is part of MimeKit a different library
                  var message = MimeMessage.Load(new MemoryStream(_attachmentContent));
                  foreach (MimeEntity _mimeEntity in message.Attachments)
                  {
                    if (_mimeEntity.ContentType.MimeType != null &&
                        _mimeEntity.ContentType.MimeType.Equals(@"application/pdf", StringComparison.OrdinalIgnoreCase))
                    {
                      MimePart _mimePart = (MimePart)_mimeEntity;

var fileStream = File.Create(_attachmentFolder + "\\" + _mimePart.FileName);
                      _mimePart.ContentObject.Stream.Seek(0, SeekOrigin.Begin);
                      _mimePart.ContentObject.DecodeTo(fileStream);
                      fileStream.Close();

//Create PDF Entry in the database
                      CreatePDF(_emailEntity, _mimePart.FileName);
                    }
                  }
                }
                else
                {
                  string _extension = System.IO.Path.GetExtension(_fileName);
                  if (_extension != null &&
                      _extension.Equals(".pdf", StringComparison.OrdinalIgnoreCase))
                  {
                    byte[] _attachmentContent = Imap.FetchAttachmentBytes(_email, _iAttachment);
                    File.WriteAllBytes(_attachmentFolder + "\\" + _fileName, _attachmentContent);

//Create PDF Entry in the database
                    CreatePDF(_emailEntity, _fileName);
                  }
                }
              }

Answer

After digging into the code, I see that it's not possible to consider the attachments contained within an attached message as "attachments" in the outer-layer email. In other words, technically the troublesome email has no direct attachments. It only has an attached message. After the fix, fetching that email will indicate that it has no attachments.

Here's the new build with the fix:

http://chilkatdownload.com/prerelease/chilkatdotnet46-9.5.0-win32.zip
http://chilkatdownload.com/prerelease/chilkatdotnet46-9.5.0-x64.zip


Answer

After downloading the email w/out attachments, check the email.NumAttachedMessages property. If non-zero, then get the attached message, and any attachments contained within it should be present (I think.. I still need to test this..)