get Sent mail using IMAP

六眼飞鱼酱① 提交于 2019-12-12 01:21:37

问题


I'm trying to fetch my sent mail using IMAP in C# but even after a considerable amount of time, i've not been able to make it work.

The output given to me is null even when 12 emails are fetched. Consider the following screenshot

The only help/hint i got on stackoverflow is this:

  • get sent mails via imap

[UPDATE]

This is my code:

>             ImapClient client = new ImapClient("ExampleHost", port, ssl);
>             try
>             {
>                 client.Login("ExampleEmail", "ExamplePass", AuthMethod.Login);
>                 IEnumerable<uint> units = client.Search(SearchCondition.Seen());
>                 DataTable TempTaskTable = new DataTable();
>                 TempTaskTable.Columns.Add("FromEmail", typeof(string));
>                 TempTaskTable.Columns.Add("ToEmail", typeof(string));
>                 TempTaskTable.Columns.Add("Subject", typeof(string));
>               
>                 foreach (var uid in units)
>                 {
>                     System.Net.Mail.MailMessage email = client.GetMessage(uid,true, "[Gmail]/Sent Mail");
>                     DataRow TempTaskRow2 = TempTaskTable.NewRow();
>                     TempTaskRow2["FromEmail"] = email.Sender;
>                     TempTaskRow2["ToEmail"] = email.From;
>                     TempTaskRow2["Subject"] = email.Subject;
>                 }
>                 bool result = false;
>                 string msg = "";
>                 usp_TempTasksSave(TempTaskTable, TempTaskAttachmentDatatTable, out result, out msg);
>             }
>             catch (Exception ex)
>             {
>                 string exceptionCheck = ex.Message;
>             }

Any sort of help would really be appreciated.

来源:https://stackoverflow.com/questions/41463400/get-sent-mail-using-imap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!