Open bigbadabam opened 5 years ago
I used SearchCondition.SentSince to filter messages by date, but in the following example search method returns empty uids collection:
static void Main(string[] args) { string hostname = "imap.yandex.ru", username = "mymail@yandex.ru", password = "mypass"; using (ImapClient client = new ImapClient(hostname, 993, username, password, AuthMethod.Login, true)) { Console.WriteLine(">> Connected"); IEnumerable<uint> uids = client.Search(SearchCondition.SentSince(new DateTime(2018, 01, 01))); Console.WriteLine(">> Mail list received"); IEnumerable<MailMessage> messages = client.GetMessages(uids); Console.WriteLine(">> Messages received"); //string[] keys = { "Date", "From", "Return-Path" }; string[] keys = { "Date"}; foreach (var message in messages) { foreach (string s in keys) { Console.WriteLine(" {0}: {1}", s, message.Headers[s]); } Console.WriteLine(); } } Console.ReadLine(); }
When I used SearchCondition.All() I have following output:
Date: Thu, 05 Feb 2015 20:30:02 +0300 Date: Sun, 11 Dec 2016 14:58:23 +0400 Date: Sun, 11 Dec 2016 20:38:14 +0400 Date: Thu, 27 Jul 2017 17:41:57 +0400 Date: Tue, 03 Oct 2017 12:36:48 +0300 Date: Tue, 03 Oct 2017 15:42:34 +0300 Date: Tue, 03 Oct 2017 22:19:05 +0300 Date: Wed, 4 Oct 2017 16:30:46 +0400 Date: Sun, 08 Apr 2018 10:16:16 +0300 Date: Fri, 13 Apr 2018 09:56:55 +0000 Date: Tue, 30 Oct 2018 14:46:35 +0400 Date: Mon, 14 Jan 2019 14:09:47 +0300 Date: Fri, 22 Mar 2019 15:09:52 +0300 Date: Tue, 26 Mar 2019 11:30:13 +0300 Date: Thu, 28 Mar 2019 13:30:44 +0300 Date: Tue, 2 Apr 2019 17:20:28 +0300 Date: Tue, 9 Apr 2019 17:00:36 +0300 Date: Thu, 18 Apr 2019 18:10:13 +0300 Date: Fri, 19 Apr 2019 00:19:25 +0300 Date: Fri, 19 Apr 2019 07:45:51 +0000 Date: Fri, 19 Apr 2019 15:01:21 +0300 Date: Tue, 23 Apr 2019 15:31:19 +0300 Date: Tue, 30 Apr 2019 12:30:04 +0300
So what's wrong?
I'm using another tool and in my case the "SENTSINCE" and "SENTBEFORE" are ignored by Yandex. "SINCE" and "BEFORE" do work.
I used SearchCondition.SentSince to filter messages by date, but in the following example search method returns empty uids collection:
When I used SearchCondition.All() I have following output:
So what's wrong?