有没有一种方法,以确定是否电子邮件是使用EWS C#中的应答/响应? [英] Is there a way to determine if a email is a reply/response using ews c#?

查看:245
本文介绍了有没有一种方法,以确定是否电子邮件是使用EWS C#中的应答/响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个支持系统,这是一个使用EWS我的第一次。到目前为止,我已经与它相当成功。我可以提取我需要的信息。发送emaisl,一切伟大的工作。我有一个小的头疼。有没有办法告诉如果电子邮件实际上是在一个答复?该应用程序的基本思想是有人发送电子邮件。我们回复,给他们一个参考号码。这样做是和伟大的工作。现在,如果他们回复此相同的地址,我们需要登录我们的数据库就有点不同。因此,我需要一些神奇的方式告诉如果邮件是一个答复。到目前为止,我卡住了。



任何建议,将不胜感激,因为我在编程行业新迄今为止谷歌搜索却一无所获有用。我有一段代码此处



  FindItemsResults<项目> findResults = service.FindItems(WellKnownFolderName.Inbox,视图); 

的foreach(在findResults.Items.Where(我项目myItem = GT;我是EmailMessage))
{
变种的MailItem = myItem为EmailMessage;
如果(!mailItem.IsRead)
{
//加载主要特性,并得到一个文本主体类型
mailItem.Load(属性集);
//更新项目电子邮件
mailItem.IsRead = true来isRead;
mailItem.Update(ConflictResolutionMode.AutoResolve); //检查

如果它是一个答复,并标记味精这样

//添加消息,列出
SupportEmailMessage味精=新SupportEmailMessage();
msg.Subject = mailItem.Subject;
msg.MessageBody = mailItem.Body.Text;
msg.DateSent = mailItem.DateTimeSent;
msg.Sender = mailItem.Sender.Address;
toReturnList.Add(MSG);
}

}


解决方案

确定。因此,从评论。看来这是不是真的有一个明确的办法。人的评论让我得到这个答案,并关闭该线程。我会改写并张贴在这里。所以先。感谢您的答案。



最简单的方法就是在您的主题一个很好的参考数字。如增刊-1234



现在在代码中,我们可以为您在标题的编号。如果它的存在。它是最有可能的响应。检查RE也是一种选择,但有些效果较差。在令人失望的是,客户可以从主题词中删除参考号码/ RE。对于那些家伙。可怜你,你的问题将不会被记录下来。或者你知道的。为所欲为。 :)



再次感谢所有响应。你们真的帮了我很多!


I am writing a support system and this is my first time using EWS. Thus far I have been quite successful with it. I can extract the info I need. Send emaisl and everything is working great. I do have one small headache. Is there a way to tell if an email is in fact a reply ? The basic idea of the app is someone sends an email. We reply and give them a reference number. This is done and working great. Now if they reply to this same address, we need to log it a bit different in our database. thus I need some magical way to tell if the email is a reply. Thus far I am stuck.

Any suggestions will be greatly appreciated as I am new in the programming industry and thus far googling turned up nothing useful. I include a section of code here

 FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, view);

        foreach (Item myItem in findResults.Items.Where(i => i is EmailMessage))
        {
            var mailItem = myItem as EmailMessage;
            if (!mailItem.IsRead)
            {
                // load primary properties and get a text body type
                mailItem.Load(propertySet);
                // Update the item to isRead in email
                mailItem.IsRead = true;
                mailItem.Update(ConflictResolutionMode.AutoResolve);

                //Check if it is a reply and mark the msg as such

                // add message to list
                SupportEmailMessage msg = new SupportEmailMessage();
                msg.Subject = mailItem.Subject;
                msg.MessageBody = mailItem.Body.Text;
                msg.DateSent = mailItem.DateTimeSent;
                msg.Sender = mailItem.Sender.Address;
                toReturnList.Add(msg);
            }

        }

解决方案

Ok. So from the Comments. It seems that There is not really a definitive way. People's comments helped me get this answer and to close this thread. I will reword and post it here. So first. Thanks for all your answers.

The most simple way is to include a good reference number in your subject. Such as "Supp-1234"

Now in code we can check for that reference number in the heading. If it is there. It is most likely a response. Checking for RE is also an option, but somewhat less effective. The bummer is that clients can remove the reference number/RE from the subject heading. For those guys. Poor you, your issue won't get logged. or you know. do whatever. :)

Thanks again to all responses. You guys really helped me a lot !

这篇关于有没有一种方法,以确定是否电子邮件是使用EWS C#中的应答/响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆