Search code examples
c#.netemailemail-client

Find default email client


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.


Solution

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