IMAP: Download email without attachments and downloading attachments separately.

Chilkat version 9.3.0, being released this week, includes new IMAP functionality to fetch emails without downloading attachments, and then subsequently fetch attachments one at a time separately.

There is a new boolean property named “AutoDownloadAttachments”, which has  a default value of True (YES).  If set to False (NO), then all Fetch* methods will not download attachments.

Note:  “related” items are downloaded.  These are images, style sheets, etc. that are embedded within the
HTML body of an email, and are not considered attachments.

Also:  All signed and/or encrypted emails must be downloaded in full.

When an email is downloaded without attachments, the attachment information is included in header fields.  The header fields have names beginning with “ckx-imap-“.  The attachment information can be obtained via the following methods:


Individual attachments can be downloaded via the newly added FetchAttachment* methods:

  1. FetchAttachment:  Downloads an attachment and saves to a file.
  2. FetchAttachmentBytes:  Downloads an attachment to an in-memory byte array.
  3. FetchAttachmentString: Downloads an attachment to a string variable.

Here are the FetchAttachment* method signatures in Objective-C:

// method: FetchAttachment
– (BOOL)FetchAttachment: (CkoEmail *)email
attachIndex: (NSNumber *)attachIndex
saveToPath: (NSString *)saveToPath;

// method: FetchAttachmentBytes
– (NSData *)FetchAttachmentBytes: (CkoEmail *)email
attachIndex: (NSNumber *)attachIndex;

// method: FetchAttachmentString
– (NSString *)FetchAttachmentString: (CkoEmail *)email
attachIndex: (NSNumber *)attachIndex
charset: (NSString *)charset;

Tags :