简体   繁体   English

在ASP.net网页上显示交换邮件的最佳方法是什么?

[英]What is the best way to display an exchange mail message on an ASP.net web page?

I have a list of actions happend on an item listed on an ASP.net website. 我有一个在ASP.net网站上列出的项目上发生的操作的列表。 These actions are logged in a simple sql table linked to the item. 这些操作记录在链接到该项目的简单sql表中。 ie: 即:

[2013-11-04 18:00]: Problem solved
[2013-11-04 18:00]: Called User
[2013-11-04 14:00]: Mail Received

For this, I will have to query the support mailbox for new mail messages. 为此,我将不得不向支持邮箱查询新邮件。 When a new message is received, a 'mail received' action is created. 收到新消息时,将创建“已收到邮件”操作。 The 'mail recieved' entry should be clickable so the support user can see the contents of this message. “已收到邮件”条目应该是可单击的,以便支持用户可以看到此消息的内容。

Question: How do I show this message to the support user? 问题: 如何向支持用户显示此消息?

Using Exchange Webservices Managed API 2.0 I can find this message and his body but the message body can have inline images and other layouts. 使用Exchange Webservices托管API 2.0,我可以找到此消息及其正文,但是该邮件正文可以具有嵌入式图像和其他布局。

Options: 选项:

  1. Show the message on the web page try to render the mail message the best way I can. 在网页上显示消息,尝试以最佳方式呈现电子邮件。
    -> Are there any free plugins that do this? ->有没有免费的插件可以做到这一点? Something like this but that can be used in a web page? 喜欢的东西, 却可以在网页中使用?

  2. Use Outlook to display this email message. 使用Outlook显示此电子邮件。

  3. 1&2 combined.. show a preview text-only message and click to see the whole message using outlook. 1&2组合在一起。显示预览文本消息,然后单击以使用Outlook查看整个消息。

Since the support user will have Outlook 2010 or higher installed on his machine, the 3th option seems a logical choice but how can I display this message in outlook? 由于支持用户将在其计算机上安装Outlook 2010或更高版本,因此第三个选项似乎是一个合理的选择,但是如何在Outlook中显示此消息?

@{
    HttpContext.Current.Response.AddHeader("Content-disposition", "inline;filename=message.msg");
    HttpContext.Current.Response.ContentType = "application/vnd.ms-outlook";
}
@(new HtmlString(ViewBag.Body))

Obviously doesn't work.. a .msg file seems binary. 显然不起作用..msg文件似乎是二进制的。 Do I need an API for this? 我需要一个API吗?

But even when this works I will have these problems: 但是即使这样做有效,我也会遇到以下问题:

  1. Every time you open a message you will have to click 'Open' to view this message. 每次您打开一条消息时,都必须单击“打开”以查看此消息。
    -> Can I prevent this in modern browsers (primarily IE10 & IE11)? ->我可以在现代浏览器(主要是IE10和IE11)中防止这种情况吗?
    -> Or are there 'inline outlook viewers' available? ->还是有“内联Outlook查看器”可用?
  2. When this support user answers this message using his outlook, this message will be sent 'from' his account. 当此支持用户使用其外表回答此消息时,将“从”他的帐户发送该消息。 There would be no trace of this sent message! 此发送的消息将没有任何痕迹!
    -> Can anyone think of a way around this? ->谁能想到解决方法?

We are using an on-premise Exchange 2010 SP3 server that should be migrated to Exchange Online some time next year. 我们正在使用内部部署的Exchange 2010 SP3服务器,该服务器应在明年的某个时候迁移到Exchange Online。 Application is running on ASP.NET 4.5 using MVC 5.0 framework. 应用程序使用MVC 5.0框架在ASP.NET 4.5上运行。

Tinker with the different body types and retrieval methods. 修补不同的身体类型和检索方法。 Info here: 此处的信息:

http://msdn.microsoft.com/en-us/library/ee217562(v=exchg.80).aspx http://msdn.microsoft.com/zh-CN/library/ee217562(v=exchg.80).aspx

See if any of them return something that's relatively easy to display, whether that be parsing the HTML body or showing the RTF body in the browser. 看看它们是否返回相对容易显示的内容,无论是解析HTML正文还是在浏览器中显示RTF正文。 I haven't mucked with this much and don't have an Exchange server handy or I'd check myself. 我并没有为此烦恼,也没有方便的Exchange服务器,否则我会自己检查一下。 If Exchange doesn't chew up the HTML when the message is send, you may be able to parse out the src="cid:contentIdOfAttachment" and replace it with a proper link to the attachment for display in the browser, but Exchange can do funny things to HTML and CSS. 如果在发送邮件时Exchange并未咀嚼HTML,则您可以解析src =“ cid:contentIdOfAttachment”并将其替换为指向附件的正确链接,以在浏览器中显示,但是Exchange可以HTML和CSS的有趣之处。

And for clarification, by "support user", do you mean a support employee (ie, tech support) or someone who is receiving support and checking on the status of their ticket? 为了澄清起见,“支持用户”是指支持员工(即技术支持)还是正在接受支持并检查其票务状态的人员? If the message is to be shown and/or replied to in Outlook, would this person be accessing a single support mailbox (perhaps a public folder) or would the message be forwarded/copied to the person's individual mailbox? 如果要在Outlook中显示和/或回复邮件,此人将访问单个支持邮箱(也许是公用文件夹),还是将邮件转发/复制到该人的个人邮箱?

If I'm getting this right, you'll be copying it to an individual mailbox, and from there it's "outside" the system, so the reply goes straight to the end user and skips the central support mailbox. 如果我做对了,您将其复制到一个单独的邮箱,然后从该邮箱“复制”到系统外部,因此答复将直接发送给最终用户,并跳过中央支持邮箱。 You might be able to circumvent this by altering the message before it is sent/downloaded by changing the "from" to the central support mailbox. 通过将“发件人”更改为中央支持邮箱,您可以通过更改消息的发送/下载之前的方式来规避此问题。 When the support user responds, it goes back to the central support mailbox, where you can have a secondary sync action (or even the same one that's fetching incoming mail) process it, change the to/from to send to the intended recipient from the central support mailbox, and send it off by using UpdateItems and saving it to the Sent folder. 当支持用户做出响应时,它会返回到中央支持邮箱,您可以在该邮箱中进行辅助同步操作(甚至是用于获取传入邮件的同一个同步操作),然后将“收件人”更改为“从”或“从”发送给预期的收件人中央支持邮箱,然后使用UpdateItems将其发送出去并将其保存到“已发送”文件夹中。 It's not pretty, but it should be possible. 它不漂亮,但应该可以。 That's just off the top of my head, though, so there could easily be a better solution. 但是,那只是我的头上的事,因此很容易找到更好的解决方案。 And I'm operating on a few assumptions about the system you're working in, so maybe I have things a bit wrong. 而且我正在对您正在使用的系统进行一些假设,所以也许我有些不对劲。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM