Register Windows program with the mailto method programmatically

Just how do I make it so mailto: web links will be signed up with my program?

Just how would certainly I after that take care of that occasion in my program?

A lot of the remedies I located from a fast Google search are just how to do this by hand, yet I require to do this instantly for customers of my program if they click a switch, such as "set as default e-mail customer".


Gotten rid of reference to Delphi, due to the fact that the solution is independent of your language.

2019-05-03 18:21:43
Source Share
Answers: 3

Here is the main Microsoft Solution to programmatically transform the default mail customer. It's Visual Basic, yet I wish the principle is clear from this :

2019-05-07 17:02:00

From what I've seen, there are a couple of computer system registry keys that set the default mail customer. Among them being :

System Key : [HKEY_CLASSES_ROOT\mailto\shell\open\command]

Value Name : (Default)

Data Type : REG_SZ (String Value )

Value Data : Mail program command-line.

I'm not familar with Delphi 7, yet I make certain there are some computer system registry editing and enhancing collections in there that you can make use of to change this value.

Some areas detail greater than this key , others simply this key, so you might require to examine a little to locate the correct one (s ).

2019-05-07 17:00:30

@Dillie-O : Your solution placed me in the appropriate instructions (I need to have anticipated it to simply be a computer system registry adjustment ) and also I obtained this working. Yet I'm mosting likely to note this as the solution due to the fact that I'm mosting likely to place some added details that I located while working with this.

The remedy to this inquiry actually does not matter what shows language you're making use of, as long as there's some means to change Windows computer system registry setups.

Ultimately, below's the solution :

  • To associate a program with the mailto method for all customers on a computer system, transform the HKEY_CLASSES_ROOT \ mailto \ covering \ open \ command Default value to :
    " Your program's executable " "% 1"
  • To associate a program with the mailto protocol for the , transform the HKEY_CURRENT_USER \ Software \ Classes \ mailto \ covering \ open \ command Default value to :
    " Your program's executable " "% 1"

The %1 will certainly be changed with the whole mailto URL. As an example, offered the link :

<a href="mailto:[email protected]">Email me</a>

The adhering to will certainly be implemented :
" Your program's executable " "mailto :customer"

Update (using comment by shellscape ) :
As of Windows 8, this method no more functions as anticipated. Win8 applies the adhering to key : HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ Shell \ Associati ons \ URLAssociations \ MAILTO \ UserChoice for which the ProgID of the picked application is hashed and also can not be built. It's an imperial PITA

2019-05-07 16:50:16