I would like to set the standard email client in Windows 7 from .NET code, how do I do it?
Asked
Active
Viewed 470 times
1
-
setting the default email client is most likely a feature of the operating system that .NET has no access to – jbabey May 03 '13 at 12:37
-
1I am not going to make this an answer since I am not sure, but you may want to look into altering Registry variables for this. – dkroy May 03 '13 at 12:37
-
1[Registering an Application for Use with Default Programs](http://msdn.microsoft.com/en-us/library/windows/desktop/cc144154(v=vs.85).aspx#registration) – Damien_The_Unbeliever May 03 '13 at 12:52
-
@Damien_The_Unbeliever, +1, good reference. – Alex Filipovici May 03 '13 at 12:53
2 Answers
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:
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
-
Thank you dkroy, that works like a charm (on computers without Outlook) – user2334811 May 03 '13 at 13:03
-
@user2334811 glad I could help, if that is what you needed then I would appreciate it if you could accept my answer. – dkroy May 07 '13 at 15:08