I have using a console app for downloading document from the mail using IMAP Service. I use "S22.Imap" assembly in application for the IMAP. I got the all mails contains attached files in IEnumerable. How could I download these Files?
using (ImapClient client = new ImapClient(hostname, 993, username, password, AuthMethod.Login, true))
{
IEnumerable<uint> uids = client.Search(SearchCondition.Subject("Attachments"));
IEnumerable<MailMessage> messages = client.GetMessages(uids,
(Bodypart part) =>
{
if (part.Disposition.Type == ContentDispositionType.Attachment)
{
if (part.Type == ContentType.Application &&
part.Subtype == "VND.MS-EXCEL")
{
return true;
}
else
{
return false;
}
}
return true;
}
);
}
I would appreciate it, if you give a solution