since we installed Chilkat IMAP v9.3.2 the method email.GetHeaderField("ckx-imap-uid") returns an empty string. Also the (new?) method email.GetImapUID returns 1, so this is probably the index that is returned.
How do I retrieve the UID as before ?
We do the following :
asked Aug 20 '12 at 08:00
I ran the same test, but everything works as expected: The ckx-imap-uid header is present, and the UID_string is returned as expected. To verify that you are using v9.3.2, examine the contents of the email.LastErrorText property after calling email.getHeaderField. Make sure the "DllDate" line within the LastErrorText shows a date from August 2012.
answered Aug 20 '12 at 13:40
Just tested both methods, followed by lasterrortext :
answered Aug 21 '12 at 02:50
This works :
In v9.3.1 the UID was available after fetchbundle
answered Aug 21 '12 at 03:35
I found the cause of the problem. I was testing in C++, but the problem only occurs with the ActiveX. There is a reason the "ckx-*" headers are not available, and it's due to performance and other issues that are specific to the ActiveX. In the non-ActiveX implementations, a pointer (reference) to an email object can simply be added to a bundle object. In other words, the bundle object takes ownership of the email object.
However, w/ the ActiveX it's not possible. Inserting an email into a bundle object can only be done by passing the serialized email (i.e. the MIME source) to the bundle, which then loads the MIME into an internal email object such that the bundle now contains a copy of the email object.
Here's how FetchBundle worked internally before:
There are two big problems here:
The newer version takes a lazy approach to solve both (1) and (2) FetchBundle simply passes the MIME as-is to the ChilkatEmailBundle2, and the ChilkatEmailBundle2 simply saves the MIME (internally in-memory) without any interpretation. So.. if for example, 100 emails are downloaded, the FetchBundle will not have parsed, re-composed, and re-parsed all 100. Nothing is parsed and the MIME is simply stored (in-memory) within the ChilkatEmailBundle2 object. It is at the point of accessing the email object from the bundle that the MIME is parsed and the email object is returned. Given that this is the 1st parsing of the MIME, the email object properties regarding digital signatures and encryption will be correct. Also, the ChilkatEmailBundle2 will now keep a reference to the email object so that it's not re-parsed if the email is accessed again. Unfortunately, the unintended side-effect is that the "ckx-*" headers are not available.
Fixing this side-effect is something that can be considered in the future, but unfortunately not at this moment.
The solution for now is to not use FetchBundle. Instead, write a loop that iterates over each email in the message set and fetches it separately. You should find the "ckx-*" headers present when doing it this way.
answered Aug 21 '12 at 14:29
OK thanks. I need to go and make some changes then ...
Bundle = IMAP.FetchHeaders(MessageSet)
Email = Bundle.Getmail(index)
UID = Email.GetImapUID
Email = IMAP.FetchSingle(UID,1)
Should do the trick
Or even "better"
UID = MessageSet.GetID(index)
Email = IMAP.FetchSingle(UID,1)
answered Aug 22 '12 at 03:15