We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to get email from specific subfolders using IMAP?

How to get email from specific subfolders using imap?
like i want to get email from Drafts folder .so how to achieve without loop to find folders

@mukundmalpaniweb,
Thank you for posting the query. You can fetch email messages from a specified folder as shown below:

var messageInfos = imapClient.ListMessages("Drafts");
foreach (var messageInfo in messageInfos)
{
    var mailMessage = imapClient.FetchMessage(messageInfo.UniqueId);
    // ...
}

Documents: Working with Messages from IMAP Server
API Reference: ImapClient Class

Im doing same but Drafts folder is Subfolder of GMAIL…so cant message by passing name…what is another solution

@mukundmalpaniweb,
For predefined folders, please use the ImapMailboxInfo class as shown below:

var sentFolderName = imapClient.MailboxInfo.DraftMessages.Name;
var messageInfos = imapClient.ListMessages(sentFolderName);

Documents: Working with Folders on IMAP Server
API Reference: ImapMailboxInfo Class