打开默认客户端窗口以及C#中的附件 [英] Open default client window along with attachment in C#

查看:120
本文介绍了打开默认客户端窗口以及C#中的附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过以下代码:



I have tried below code:

var proc = new System.Diagnostics.Process();

  proc.StartInfo.FileName = string.Format("\"{0}\"", Process.GetProcessesByName("OUTLOOK")[0].Modules[0].FileName);

  proc.StartInfo.Arguments = string.Format(" /c ipm.no
te /m {0} /a \"{1}\"", "someone@somewhere.com", @"C:/Users/gokul/Desktop/ACT .zip");

  proc.Start();





我的尝试:



但这段代码总是返回Outlook窗口。



但是我需要默认的电子邮件客户端窗口来自我们的设备,像MAIL,谷歌铬,OUTLOOK



请分享你的答案,



What I have tried:

But this code always returned outlook window.

But I need default email client window which is from our device, Like MAIL, Google chrome , OUTLOOK

Please share me your answers,

推荐答案

嗯。 ..这被标记为Javascript以及C# - 这意味着您将其编写为在客户端浏览器中运行的Web应用程序。



这意味着不会工作,完全没有 - 或者至少它不会在生产中工作,即使你确实让它在开发中工作。

Process.Start是C# - 它始终在服务器上运行,从不在客户端上。这意味着应用程序 - 无论它是什么 - 始终在服务器上打开,用户无法看到它,而不是在客户端可以看到的位置。它似乎在开发中起作用(至少部分),因为客户端和服务器是同一台机器。生产中并非如此,两台机器的距离实际上相距数千英里。



您不能使用服务器代码在客户端上运行任何应用程序,除非在非常非常特殊的情况下,在99.999%的情况下不会发生这种情况。具体来说,客户端必须运行IE(不是Edge,Chrome或Firefox,或Opera,或......);他必须允许下载ActiveX控件(默认情况下禁用);他必须允许ActiveX控件运行(默认情况下禁用);并且你必须编写一个ActiveX控件来执行它。

这不会发生。
Um... this is tagged as Javascript as well as C# - which implies you are writing this as a web app running in the client browser.

Which means that won't work, not at all - or at least it won't work in production, even if you do get it to work in development.
Process.Start is C# - which always runs on the Server, never on the Client. Which means that the application - whatever it is - always opens on the Server, where the user can't see it, not on the Client where he could. It appears to be working (at least in part) in development because the Client and the Server are the same machine. This isn't the case in production where the two machines can be literally thousands of mile apart.

You cannot cause any application to run on a client using server code except in very, very specialised circumstances which ado not occur in 99.999% of cases. Specifically, the client must be running IE (not Edge, or Chrome, or Firefox, or Opera, or ...); he must permit the download of an ActiveX control (disabled by default); he must permit an ActiveX control to run (disabled by default); and you must write an ActiveX control to do it.
This doesn't happen.


这篇关于打开默认客户端窗口以及C#中的附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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