我正在开发Windows 7/8/8.1在C#WPF中的应用程序,为此我需要知道系统默认邮件客户端是什么。如何检查Windows系统上安装的默认邮件客户端是什么?
我搜索#1和谷歌,我发现了什么是
RegistryKey hklm = Registry.LocalMachine;
RegistryKey mailClients = hklm.OpenSubKey("SOFTWARE\\Clients\\Mail");
string defaultClient = (string)mailClients.GetValue("");
if (defaultClient == null)
{
MessageBox.Show("Error");
return;
}
else
Process.Start("mailto: " + "?subject=" + SomeSubject + "&body=" + Body);
但在看到这不是一个最佳的解决方案在Windows系统中检查默认邮件客户端少数情况下。例如,我有一个系统,其中安装了OutLook 2010
,当我尝试打开outlook email
窗口时,出现错误,"The command line argument is not valid. Verify the switch you are using".
有没有找到系统是否具有默认邮件客户端的完美方法。它可以是任何东西时,Outlook,Gmail,雅虎邮件,Thunderbird等
感谢
德布
我认为这可能[帮助](http://stackoverflow.com/questions/15393488/check-default-mail-client-using-c-sharp-code) – Kcvin
其他原因它可能不工作它因为mailto后有一个空格:应该有一个电子邮件地址。试图用无效的字符串开始一个进程可能没有帮助。 – Kcvin