通过网页发送 Outlook 电子邮件
我有一个使用 ASP.net 和 C# 开发的 Web 应用程序,该应用程序在我公司的 Intranet 上运行。 由于该应用程序的所有用户无一例外都使用 Microsoft Outlook,因此我希望该应用程序能够在客户端打开 Outlook 消息。 我知道 Office 设计为在桌面上运行,而不是从服务器运行,但是我在客户端创建 Word 或 Excel 文档时没有遇到任何问题。
我有实例化 Outlook 对象的代码使用 Microsoft.Office.Interop.Outlook 命名空间和服务器上安装的 Outlook。 当我尝试从服务器运行代码时,收到一条 DCOM 源错误消息,指出“计算机默认权限设置未向 CLSID 为 {000C101C-0000-0000-C000-000000000046 的 COM 服务器应用程序授予本地激活权限” } 给用户 此安全权限可以使用组件服务管理工具进行修改。” 我已使用组件服务工具修改了权限,但仍然出现相同的错误。
有没有办法克服这个问题,或者这是一个徒劳的尝试,因为 Outlook 无法从服务器端代码在客户端打开?
由于电子邮件可以获得的长度过长,Mailto 将无法工作。 此外,发送它的用户需要在文本中为收件人添加美观的内容。
I have a web application developed with ASP.net and C# that is running on my companies' intranet. Because all the users for this application are all using Microsoft Outlook without exception, I would like for the the application to open up an Outlook message on the client-side. I understand that Office is designed to be run on the desktop and not from a server, however I have no trouble creating a Word or Excel document on the client-side.
I have code that instantiates the Outlook object using the Microsoft.Office.Interop.Outlook namespace and Outlook installed on the server. When I try to run the code from the server, I get a DCOM source error message that states "The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID {000C101C-0000-0000-C000-000000000046} to the user This security permission can be modified using the Component Services administrative tool." I have modified the permissions using the Component Services tool, but still get this same error.
Is there a way to overcome this or is this a fruitless exercise because Outlook cannot be opened on the client side from the server-side code?
Mailto will not work due to the extreme length that the emails can obtain. Also, the user that sends it needs add in eye-candy to the text for the recipients.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
(提示:您问题中的格式)
我不明白 mailto 链接或 formmail 类型页面有什么问题。
(hint: formatting in your question)
I'm not understanding what's wrong with a mailto link or a formmail-type page.
您无法从服务器端代码在客户端打开某些内容。 您必须使用页面上的脚本来执行您想要的操作(或者其他客户端,如 ActiveX 或嵌入式 .NET 等)。
下面是一个从网页调用 Outlook MailItem 的示例 Javascript。 这可以很容易地从服务器端代码注入到页面中,以便它在客户端上执行。
http://www.codeproject.com/KB/aspnet/EmailUsingJavascript.aspx
You cannot open something on the client from server side code. You'd have to use script on the page to do what you're wanting (or something else client-side like ActiveX or embedded .NET or something)
Here's a sample Javascript that invokes an Outlook MailItem from an webpage. This could easily be injected into the page from your server-side code so it executes on the client.
http://www.codeproject.com/KB/aspnet/EmailUsingJavascript.aspx
如果公司中的每个人都使用 Outlook,那么只需使用标准的“mailto”链接就应该始终打开 Outlook。 听起来你对此进行了过度设计。
If everyone in the company uses Outlook, then just using a standard "mailto" link should always open Outlook. It sounds like you're over-engineering this.
我会把它扔在那里,因为有人问过它。
Mailto 有很多缺点; 主要是尺寸。 由于发件人需要对电子邮件文本进行大量格式化,因此生成的 html 代码可能会占用大量空间,在使用 mailto 时会失败。
还是)感谢你的建议。
I'll just throw this out there cuz it's been asked.
Mailto has a lot of disadvantages; mainly size. Since the sender needs to do alot of formatting on the email text, the html code generated can take up a lot of space that fails when using mailto.
thanks for the suggestion though.
您想打开一封现有电子邮件还是创建一封新电子邮件?
也许我误解了你的问题; 您能否提供如下链接:
当用户单击该链接时,将打开一个新的 Outlook 电子邮件,并且:
所有这些字段均已从链接中填写。
Do you want to open an existing E-Mail or create a new one?
Perhaps I misunderstood your question; could you provide a link like:
When the user clicks on that a link, a new Outlook-E-Mail will be opened and the:
All these fields are already filled from the link.