Click here to Skip to main content
15,885,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have tried below code:

C#
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();


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,
Posted
Updated 24-Aug-16 5:17am

1 solution

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.
 
Share this answer
 
Comments
Member 12172426 24-Aug-16 12:47pm    
@originalGriff I can't Get your answer. Is possible to open default mail window along with attachment?
OriginalGriff 24-Aug-16 14:01pm    
What part of it do you not understand?
What part do you want clarified?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900