2

I have tried below ways to achieve this,

     1, mailto:
     2, Registrykeys  - @"HKEY_CLASSES_ROOT\mailto\shell\open\command", "", "none");
     3, proc.StartInfo.FileName = string.Format("\"{0}\"", Process.GetProcessesByName("OUTLOOK")[0].Modules[0].FileName);

But this always returns outlook window only. But I want to open default mail client window like out attached Image.

Please share me your answers.

Mostafiz
  • 6,845
  • 3
  • 21
  • 37
Kalpana K
  • 59
  • 1
  • 10
  • See [here](https://stackoverflow.com/questions/45607027/how-to-open-default-mail-client-with-prepopulated-attachment-in-asp-net/) for an asp.net version and [here](https://stackoverflow.com/questions/20328598/open-default-mail-client-along-with-a-attachment) for wpf. – VDWWD Aug 10 '17 at 08:03

1 Answers1

3

This code should send mail using default mail provider in windows

var url = "mailto:emailnameu@domain.com&attachment=a.txt";
System.Diagnostics.Process.Start(url);
Mostafiz
  • 6,845
  • 3
  • 21
  • 37
  • Thank you for your response.Is this solution is possible in web.I have tried this.But in mailto attachment is not working.Please provide ur suggestions – Kalpana K Aug 26 '16 at 12:06
  • you need to map the attachment path correctly, take a look at this SO thread for getting server path http://stackoverflow.com/questions/275781/server-mappath-server-mappath-server-mappath-server-mappath – Mostafiz Aug 26 '16 at 12:10
  • better try this solution for sending mail from asp.net http://www.asp.net/web-pages/overview/getting-started/11-adding-email-to-your-web-site or this http://www.mikesdotnetting.com/article/268/how-to-send-email-in-asp-net-mvc – Mostafiz Aug 26 '16 at 12:13
  • Thanks for your response – Kalpana K Aug 26 '16 at 12:36