I´m trying to fetch all messages uids from specific folder to extract all posible information.
If input is "INBOX" the output are all messages from all folders in emails.
If the input is the folder I want to get uids, it returns "The requested folder could not be found."
This is the code:
IMailFolder mailFolder = imapClient.GetFolder(Folder);
mailFolder.Open(FolderAccess.ReadOnly);
DataTable dt = new DataTable();
dt.Columns.Add("UID", typeof(String));
dt.Columns.Add("Subject", typeof(String));
dt.Columns.Add("From Name", typeof(String));
dt.Columns.Add("From Address", typeof(String));
dt.Columns.Add("Date Sent", typeof(DateTime));
dt.Columns.Add("MessageID", typeof(String));
for (int i = 0; i < mailFolder.Count; i++)
{
DataRow dr = dt.NewRow();
MimeKit.HeaderList header = mailFolder.GetHeaders(i);
dr["Subject"] = header["Subject"];
dr["MessageID"] = header["Message-ID"];
dt.Rows.Add(dr);
}
Emails = dt;
And how can I extract SenderName,Body, SenderEmail, DateReceived and attachments??
Thank you
Folderstring contains - as in: is it "[Gmail]/All"? What folder path does it specify? If you are getting details for all messages, then you are probably opening theAllfolder. - jstedfast