Export IMAP data into mbox in single or mulitple folders selection and also get particular selected folders or subfolders emails…provide solution for mbox and eml
Platform C#
@mukundmalpaniweb,
Thank you for posting the query. I will prepare this information for you and reply as soon as possible.
@mukundmalpaniweb,
You can fetch email messages using an ImapClient
class instance as shown below:
var messageInfos = imapClient.ListMessages("FolderName");
foreach (var messageInfo in messageInfos)
{
var mailMessage = imapClient.FetchMessage(messageInfo.UniqueId);
}
An email message can be written to an Mbox file like this:
using (var mboxWriter = new MboxrdStorageWriter("test.mbox", false))
{
mboxWriter.WriteMessage(mailMessage);
}
More examples:
Working with Messages from IMAP Server
Programming with Thunderbird
API Reference:
ImapClient Class
MboxrdStorageWriter Class
var messageInfos = imapClient.ListMessages("Sent");
this not working for gmail…please provide solution for subfolders to get emails
@mukundmalpaniweb,
To fetch email messages from predefined folders, please use ImapMailboxInfo
class as shown below:
var sentFolderName = imapClient.MailboxInfo.SentMessages.Name;
var messageInfos = imapClient.ListMessages(sentFolderName);
Documents: Working with Folders on IMAP Server
API Reference: ImapMailboxInfo Class