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:
[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.