问题
I would like to set the standard email client in Windows 7 from .NET code, how do I do it?
回答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
回答2:
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());
}
}
}
来源:https://stackoverflow.com/questions/16359113/how-do-i-set-standard-email-client-in-windows-7-using-net