login about faq

Hi there, currently i am trying to look for all unseen mails in the Mailbox and save them as mime. I am not sure how to go on from the received messageSet with fetchSingleAsMime() :-/

Here is a snipped from the (example)code:

// Select an IMAP mailbox success = imap.SelectMailbox(imapfolder);

if (success != true) 

// CkMessageSet *messageSet = 0; bool fetchUids; fetchUids = true;

//  Find emails marked as unseen:
const char * notSeenSearch;
notSeenSearch = "NOT SEEN";

//  Get the set of unseen message UIDs
messageSet = imap.Search(notSeenSearch,fetchUids);
if (messageSet == 0 )

//... this is where i would need to store each unseen email as mime.eml so all info like //signed by & encryption etc. is still

//in it.Was thinking about to use this somehow -> mimeStr = imap.fetchSingleAsMime(i,bUid);

I would be very happy if someone could Show me how to go on from here!

asked Nov 07 '13 at 19:57

RootTag's gravatar image


edited Nov 07 '13 at 19:59

The CkMessageSet API is fairly straightforward.

See http://www.chilkatsoft.com/refdoc/vcCkMessageSetRef.html

You can get the number of message ID's in the CkMessageSet via the Count property. You can tell whether the message set contains sequence numbers or UID's via the HasUids property, and then you can get each ID by index via the GetId method. Just write a simple loop:

CkImap imap;
CkMessageSet *mset = 0;

// get the mset via a call to imap.Search

bool bHasUids = mset->get_HasUids();

int count = mset->get_Count();
int i;
for (i=0; i<count; i++)
    int id = mset->GetId(i);

const char *mimeStr = imap.fetchSingleAsMime(id,bHasUids);


delete mset;

answered Nov 07 '13 at 21:39

chilkat's gravatar image

chilkat ♦♦

edited Nov 07 '13 at 21:42

Not sure if my solution is an option as well, or if I should keep using it this way:

Because I need CkEMail and the CkEmailBundle plus the option for CkStringArray->SaveToFile, I did as follows (please feel free to correct me if this is a bad Option):

CkEmailBundle* bundle=0;
bundle = imap.FetchBundle(*messageSet);

CkStringArray* bundlex;
bundlex = imap.FetchBundleAsMime(*messageSet);

CkEmail* email = 0;

long i;
    for (i = 0; i <= bundle->get_MessageCount() - 1; i++) 
//...working with it here
email = bundle->GetEmail(i);

answered Nov 08 '13 at 06:29

RootTag's gravatar image


edited Nov 08 '13 at 06:29

Your answer
toggle preview

Follow this question

By Email:

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



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



Asked: Nov 07 '13 at 19:57

Seen: 1,578 times

Last updated: Nov 08 '13 at 06:29

powered by OSQA