Kalpana K
Kalpana K

Reputation: 59

Open default mail client window with attachment using c#

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.

Upvotes: 2

Views: 5003

Answers (1)

Mostafiz
Mostafiz

Reputation: 7352

This code should send mail using default mail provider in windows

var url = "mailto:[email protected]&attachment=a.txt";
System.Diagnostics.Process.Start(url);

Upvotes: 3

Related Questions