1

I would like to set the standard email client in Windows 7 from .NET code, how do I do it?

2 Answers2

1

You can find the default email program with the following Registry Key. Find it's content and mess with it:

Check the following link here at SO:

Find default email client

using System;
using Microsoft.Win32;

namespace RegistryTestApp
{
   class Program
   {
      static void Main(string[] args)
      {
         object mailClient = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail", "", "none"); 
         Console.WriteLine(mailClient.ToString());
      }
   }
}
Community
  • 1
  • 1
Carlos Landeras
  • 11,025
  • 11
  • 56
  • 82
  • [http://stackoverflow.com/a/1119872/674700](http://stackoverflow.com/a/1119872/674700) Ctrl+C / Ctrl+V. Have you even tried it? – Alex Filipovici May 03 '13 at 12:50
  • I have checked the registry key exist and its content. And the registry key class is not a mistery @AlexFilipovici. I forgot to link the post, but I'm doing it now. Thanks – Carlos Landeras May 03 '13 at 12:51
1

You would need to edit the following registry value. You would do something like the following with the Registry.SetValue Method.

Registry.SetValue(@"HKEY_CLASSES_ROOT\mailto\shell\open\command", "", "\"C:\\PROGRA~2\\MICROS~1\\Office14\\OUTLOOK.EXE\" -c IPM.Note /m \"%1\"");

Reference:
http://msdn.microsoft.com/en-us/library/3dwk5axy.aspx
dkroy
  • 2,020
  • 2
  • 21
  • 39