我正在使用 Exchange Web 服务连接到邮箱并使用FindItems和SearchFilter查找符合特定条件的邮件。
我可以在邮箱过滤“发件人”电子邮件地址中收到电子邮件,如下所示:
var service = new ExchangeService(ExchangeVersion.Exchange2010_SP1)
{
TraceEnabled = true,
Credentials = new WebCredentials(username, password)
};
var filter = new SearchFilter.ContainsSubstring(EmailMessageSchema.From, "some@email.com");
service.FindItems(WellKnownFolderName.Inbox, filter, new ItemView(50))
我可以DisplayTo
像这样过滤属性:
var filter = new SearchFilter.ContainsSubstring(EmailMessageSchema.DisplayTo, "display name");
但据我所知,仅搜索收件人的显示名称。我想搜索电子邮件地址或域名。
当我期望它时,这不会返回结果:
var filter = new SearchFilter.ContainsSubstring(EmailMessageSchema.ToRecipients, "some@email.com");
是否可以找到收件人列表包含指定电子邮件地址的所有电子邮件?