我正在使用以下代码来获取主题信息。
是否可以在不下载整个邮件的情况下知道电子邮件是否包含附件,或者更具体地说是 Excel 电子表格 (xls/xlsx)?
client.Connect("imap.gmail.com", 993);
client.Authenticate("spyperson", "secret-word");
var inbox = client.Inbox;
inbox.Open(FolderAccess.ReadOnly);
Console.WriteLine("Total messages: {0}", inbox.Count);
Console.WriteLine("Recent messages: {0}", inbox.Recent);
var uids = inbox.Search(SearchQuery.NotSeen);
foreach (var summary in inbox.Fetch(uids, MessageSummaryItems.Full | MessageSummaryItems.UniqueId | MessageSummaryItems.Flags))
{
Console.WriteLine("[summary] {0:D2}: {1}:{2}", summary.Index, summary.Envelope.Subject, summary.Flags);
}