C#EWS-已发送邮件的标识-InternetMessageId [英] C# EWS - identification for SENT emails - InternetMessageId
问题描述
我正在开发票务系统. 我需要将票证(邮件)发送到EmailAddressList并通过电子邮件接收有关此电子邮件/票证的答案. 无论如何,是否可以从我发送的新票证/电子邮件中获取InternetMessageId?
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?
谢谢!
推荐答案
请确保在发送邮件时,使用SendAndSaveCopy()
将邮件的副本放置在SentItems文件夹中.然后,您将要使用FindItems()
方法在WellKnownFolderName.SentItems
中查找消息,实例化EmailMessage
对象,然后可以查看InternetMessageId
属性.这是一个简单的示例:
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: