在调试过程中,我把范围缩小到搜索方法。我试过Mailkit2.0.6、2.7.0和.NET4.5。
有人知道这里怎么了吗?
窗户
client.Inbox.Search(SearchQuery.SubjectContains("Automation Test Schedule Subject: 6/19/2020 4:57:04 PM"));
{11234}
Count: 1
IsReadOnly: false
SortOrder: Ascending
Validity: 0
Results View: Expanding the Results View will enumerate the IEnumerable
client.Inbox.Search(SearchQuery.SubjectContains("Automation Test Schedule Subject: 6/19/2020 5:36:12 PM"));
Method 'Search' not found in type 'MailKit.IMailFolder'.
代码
using (var client = new ImapClient())
{
// connect to email client
client.Connect(RandomOutlookAccnt);
client.Authenticate(EmailAddress, Password);
client.Inbox.Open(FolderAccess.ReadOnly);
client.Idle(cts.Token);
var query = SearchQuery.SubjectContains(emailSubject);
// search unique ids of the emails in inbox
var uids = client.Inbox.Search(query);
var items = client.Inbox.Fetch(uids, MessageSummaryItems.UniqueId | MessageSummaryItems.BodyStructure);
. . . other stuff
}