C# EWS - identification for SENT emails - InternetMessageId

痴心易碎 提交于 2019-12-02 13:17:57

问题


Im developing a Tickets System. I need to send a Ticket(mail) to a EmailAddressList and receive the answers by email regarding to this Email/Ticket. Is there anyway to get an InternetMessageId from the new Ticket/Email that I sent?

Thank you!


回答1:


Make sure that when you send your messages that you use SendAndSaveCopy() to place a copy of the message in the SentItems folder. Then you will want to use the FindItems() method to look for messages in the WellKnownFolderName.SentItems, instantiate an EmailMessage object and then you can look at the InternetMessageId property. Here is a brief example:

ItemView view = new ItemView(10);
view.PropertySet = new PropertySet(BasePropertySet.IdOnly, EmailMessageSchema.InternetMessageId);
FindItemsResults<Item> results = service.FindItems(WellKnownFolderName.SentItems, view);
foreach (Item item in results)
{
    if (item is EmailMessage)
    {
        EmailMessage msg = item as EmailMessage;
        Console.WriteLine(msg.InternetMessageId);
    }
}

Here are a couple of links that may help you further:

How to: Send email messages by using EWS in Exchange

EmailMessage members



来源:https://stackoverflow.com/questions/22456187/c-sharp-ews-identification-for-sent-emails-internetmessageid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!