Find default email client

epotter picture epotter · Jul 13, 2009 · Viewed 7.2k times · Source

Using C#, how can I determine which program is registered as the default email client? I don't need to launch the app, I just want to know what it is.

Answer

Richie Cotton picture Richie Cotton · Jul 13, 2009

Use the Registry class to search the registry. This console app demonstrates the principle.

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());
      }
   }
}