Archived Forum Post

Index of archived forum posts

Question:

Fetch attachment later after downloading the email.

Jul 25 '14 at 18:12

Hi.. In my project, we don't want to download the attachments when we fetch the email. The attachments should be downloaded one by one, once the Mail details are shown and when user clicks on some attachment. We have our Data class which stores the CkoEmail email details. And we use our Data class to show the details on the UI. We don't store directly the CkoEmail object. Is there any way, to download the email attachments some time later after fetching the CkoEMail which we are not persisting as we are having the details in our Data class.

Thanks


Answer

Hi!

I use C#, but I think your code wil be the same. You should know attachment index and uid of the message. Use code like this:

        Email email = _imap.FetchSingleHeader(uid, true);
        if (email != null)
            var data = _imap.FetchAttachmentBytes(email, attachmentIndex);

Answer

See the AutoDownloadAttachments property in the online reference documentation: http://www.chilkatsoft.com/refdoc/csImapRef.html

Set the AutoDownloadAttachments property = false. Then you may download the emails without attachments. You could then fetch the full email at a later time by setting AutoDownloadAttachments = true and re-fetching. Unfortunately, it's not possible to download each attachment within a single email separately.