login about faq

I'm using the IMAP C++ component to download emails from an Inbox, I can list the attached file, but when I

call SaveAttachedFile, I get:

ChilkatLog:
GetMailAttachFilename:
DllDate: Aug 24 2012
UnlockPrefix: MWFCOMIMAPMAILQ
Username: CBE43009TBNC4J:dempseya
Architecture: Little Endian; 32-bit
Language: Visual C++ 8.0
VerboseLogging: 1
ckx-imap-attach-nm-1 header is not present
--GetMailAttachFilename
--ChilkatLog

I confirmed that get_AutoDownloadAttachments was True and I'm using FetchBundle not FetchHeaders, which is

confirmed because I can access the Message Body.

Here are the headers:

Received: from CBDCEX02.CANBURG.LOCAL ([::1]) by CBDCEX02.CANBURG.LOCAL ([::1]) with mapi id 14.01.0323.003;
     Wed, 24 Oct 2012 13:11:33 +0100
From: xxxxx <xxxxx@canburg.com>
To: xxxxx <xxxxx@canburg.com>
Subject: [1504] Mrs Mrs Jain
Thread-Topic: [1504] Mrs Mrs Jain
Thread-Index: Ac2x4MBfk4/5MJb3Q9mwU58vPL+0jQ==
Date: Wed, 24 Oct 2012 13:11:33 +0100
Message-ID: <99BE4E0EEF9E1C4D9CEB83881673C6741BD90F@CBDCEX02.CANBURG.LOCAL>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 04
X-MS-Exchange-Organization-AuthSource: CBDCEX02.CANBURG.LOCAL
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
x-originating-ip: [192.168.1.57]
Content-Type: multipart/mixed;
    boundary=_002_99BE4E0EEF9E1C4D9CEB83881673C6741BD90FCBDCEX02CANBURGLO_
MIME-Version: 1.0
X-AntiVirus: checked (incoming) by Avira MailGuard (Version: 12.3.1.15;
     AVE:8.2.10.187; VDF:7.11.47.152
ckx-imap-internaldate: 24-Oct-2012 13:11:33 +0100
ckx-imap-uid: 7
ckx-imap-isUid: YES
ckx-imap-seen: YES
ckx-imap-answered: NO
ckx-imap-deleted: NO
ckx-imap-flagged: NO
ckx-imap-draft: NO
ckx-imap-flags: \Seen

What am I doing wrong?

asked Oct 25 '12 at 06:38

Dempsey's gravatar image

Dempsey
6114

edited Oct 25 '12 at 08:21


The information in the LastErrorText is poor, and I'm improving it as we speak.

The method will first check the email header for the presence of the ckx-imap-attach-nm-1 header. This would exist if the email was downloaded without attachments (or if it was download via some other means, such as from a POP3 server, or if it was loaded from a .eml file, etc.)

In any case, the "ckx-imap-attach-nm-1 header is not present" message is only informational, because after the header is not found, the method delves into the email object itself to see if the attachment is actually present, and if so, will return the attachment's filename.

It's probable in this case that the email doesn't actually have an attachment. See this Chilkat blog post for information about what is or isn't an attachment:

http://www.cknotes.com/?p=280

link

answered Oct 25 '12 at 10:44

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

When viewing the Email in Outlook there is an attachment, also there is a header 'X-MS-Has-Attach: yes' does that not also show there is one? And also getAttachmentFilename on the email object returns the filename.

(Oct 25 '12 at 11:03) Dempsey

Please send the .eml file in a zipped attachment to support@chilkatsoft.com and I'll have a look..

(Oct 25 '12 at 13:34) chilkat ♦♦

.eml sent. Thanks.

(Oct 25 '12 at 15:48) Dempsey

I found all to be working fine. Here's the latest pre-release with the better logging:

http://www.chilkatsoft.com/preRelease/chilkat-9.4.0-x86-vc8.zip

This is the LastErrorText indicating success:

ChilkatLog:
  GetMailAttachFilename:
    DllDate: Oct 18 2012
    UnlockPrefix: UNTTSTIMAPMAILQ
    Username: CK2007:Chilkat
    Architecture: Little Endian; 32-bit
    Language: Visual C++ 8.0
    VerboseLogging: 0
    Header field does not exist
    fieldName: ckx-imap-attach-nm-1
    ckx-imap-attach-nm-1 header is not present or empty
    index: 0
    filename: DJ.tab
    Success.
  --GetMailAttachFilename
--ChilkatLog

The method first checks for the header, does not find it (which is OK), and then examines the email contents, finds the attachment and returns the filename.

link

answered Oct 25 '12 at 16:54

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

I get exactly the same output, but the SaveAttachedFile still fails? Did it save the attachment for you?

  GetMailAttachFilename:
    DllDate: Oct 19 2012
    UnlockPrefix: MWFCOMIMAPMAILQ
    Username: CBE43009TBNC4J:dempseya
    Architecture: Little Endian; 32-bit
    Language: Visual C++ 8.0
    VerboseLogging: 1
    Header field does not exist
    fieldName: ckx-imap-attach-nm-1
    ckx-imap-attach-nm-1 header is not present or empty
    index: 0
    filename: DJ.tab
    Success.
  --GetMailAttachFilename
--ChilkatLog
(Oct 25 '12 at 18:04) Dempsey

You're providing the LastErrorText for the GetMailAttachFilename method, not the SaveAttachedFile method. If emailObject.SaveAttachedFile failed, then capture the contents of emailObject's LastErrorText, NOT the imap object's LastErrorText. You need to get the LastErrorText on the same object instance that made the call...

(Oct 25 '12 at 19:57) chilkat ♦♦

Ah yea sorry, wasn't concentrating!

Turns out to be a permissions error as I was trying to save the attachment in Program Files (even though I'm an admin and can manually save files there no problem?) but now that I know that I can save elsewhere.

If I had looked at the correct LastErrorTetxt earlier I wouldn't of wasted your time, although the header missing error in the GetMailAttachFilename error put me off and made me think was an error within Chilkat library, sorry about that.

  SaveAttachedFile:
    DllDate: Oct 19 2012
    UnlockPrefix: MWFCOMMAILQ
    Username: CBE43009TBNC4J:dempseya
    Architecture: Little Endian; 32-bit
    Language: Visual C++ 8.0
    VerboseLogging: 1
    index: 0
    dir: C:\Program Files\FileMaker\FileMaker Pro 11 Advanced\
    filenameUtf8: DJ.tab
    OverwriteExisting: 1
    combinedFilenameUtf8: C:\Program Files\FileMaker\FileMaker Pro 11 Advanced\DJ.tab
    openForWriteWin32:
      Failed to open file (2)
      localFilePath: C:\Program Files\FileMaker\FileMaker Pro 11 Advanced\DJ.tab
      currentWorkingDirectory: C:\Users\dempseya\Desktop\DJs From Email
      osErrorInfo: Access is denied.
      localWindowsFilePath: C:\Program Files\FileMaker\FileMaker Pro 11 Advanced\DJ.tab
    --openForWriteWin32
    filename: C:\Program Files\FileMaker\FileMaker Pro 11 Advanced\DJ.tab
    Failed to write complete file (7)
    Failed to write file
    Failed.
  --SaveAttachedFile
--ChilkatLog
link

answered Oct 26 '12 at 04:59

Dempsey's gravatar image

Dempsey
6114

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×175
×65
×18

Asked: Oct 25 '12 at 06:38

Seen: 2,532 times

Last updated: Oct 26 '12 at 04:59

powered by OSQA