Search code examples
imapchilkat

Fetch all the mails from Mailbox including all the folders and subfolders


I am using Chilkat .Net Assemblies to fetch mails from mailboxes. Can you please tell me how can I achieve below functionalities using Chilkat?

  • It is possible to fetch all the mails from specified folder of the mailbox like Inbox, Outbox, Drafts etc. Now I have certain folders in my mailbox. What I want is to fetch all the mails from all the mailbox folders in a single go. Meaning, I want to fetch mails from Inbox, Outbox, Draft etc. etc.Is there any way to achieve this functionality using Chilkat.
  • Secondly, I have a mailbox folder with some subfolders. How can I fetch mails from the subfolders by only specified parent folder. Meaning, I have mailbox folder "Personal" within this there are two folder named "Sales" and "Purchase". IMAP.SelectMailbox("Personal") will return all the mails in this folder. My question is, will it return all the mails from the folders "Sales" and "Purchase".

Thanks, I am looking forward to it. Thanks in advance.


Solution

    1. As arnt has already pointed out, you will need to write a loop to do what you want. The body of the loop will need to SELECT the folder and then you'll need to loop to fetch each message from said folder.

    2. No. It will not fetch the messages of child folders.