簡體   English   中英

使用C#進行IMAP-AE.Net.Mail設置Gmail標志

[英]IMAP using c# - AE.Net.Mail Set Gmail Flags

我目前使用AE.Net.Mail從Gmail帳戶獲取電子郵件,到目前為止一切正常。 我的要求之一是在流程結束時放置一個特殊的gmail標志。

您可以在以下位置查看星星的工作原理: http : //fieldguide.gizmodo.com/add-extra-stars-for-better-gmail-sorting-1681334535

這是我的代碼:

//Get msgs.
Messages = imap.SearchMessages(condition2); 

foreach (Lazy<AE.Net.Mail.MailMessage> message in this.Messages)
{
     imap.AddFlags("Seen", message.Value);
     imap.AddFlags("\\Seen", message.Value);
     imap.AddFlags("\\Flagged", message.Value); 
     imap.AddFlags("green-check", message.Value);

我希望電子郵件帶有綠色復選標記,直到此刻為止,郵件都帶有黃色標記(標記),這是我遺漏的東西嗎?

非常感謝您的幫助。

您很可能無法將其設置為IMAP標志。 您最有可能需要使用AE.Net.Mail不支持的GMail的LABELS擴展名。

但是,您可以使用我的MailKit庫在GMail上操作標簽。

http://www.mimekit.net/docs/html/Overload_MailKit_MailFolder_AddLabels.htm http://www.mimekit.net/docs/html/Overload_MailKit_MailFolder_RemoveLabels.htm http://www.mimekit.net/docs/html/Overload_MailKit_MailFolder_SetLabels。 htm

要在一批郵件上請求標簽,您可以執行以下操作:

var items = folder.Fetch (uids, MessageSummaryItems.UniqueId | MessageSummaryItems.GMailLabels);
foreach (var item in items) {
    Console.WriteLine ("message {0} has the following labels: {1}", item.UniqueId,
        item.GMailLabels != null ? string.Join (", ", item.GMailLabels) : "None");
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM