user2334811
user2334811

Reputation: 21

How do I set standard email client in Windows 7 using .NET

I would like to set the standard email client in Windows 7 from .NET code, how do I do it?

Upvotes: 1

Views: 476

Answers (2)

Carlos Landeras
Carlos Landeras

Reputation: 11063

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

Upvotes: 1

dkroy
dkroy

Reputation: 2020

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

Upvotes: 1

Related Questions