Setting the default mailclient

  • Thread starter Thread starter Soren Schimkat
  • Start date Start date
S

Soren Schimkat

Hi Guys

Can someone tell me how to set the default mailclient by not using the gui?

What I need to do, is to create Mozilla Thunderbird as a selectable
mailclient, and then select Mozilla Thunderbird as the default client.

Can anyone tell me how to do it (through registry, some api or ...) - or
point me to some documentation on how to do it?

Regards Søren
 
Start > Run > %SystemRoot%\system32\control.exe appwiz.cpl,,3

--
Carey Frisch
Microsoft MVP
Windows XP - Shell/User
Microsoft Newsgroups

-------------------------------------------------------------------------------------------

:

| Hi Guys
|
| Can someone tell me how to set the default mailclient by not using the gui?
|
| What I need to do, is to create Mozilla Thunderbird as a selectable
| mailclient, and then select Mozilla Thunderbird as the default client.
|
| Can anyone tell me how to do it (through registry, some api or ...) - or
| point me to some documentation on how to do it?
|
| Regards Søren
 
Soren said:
Hi Guys

Can someone tell me how to set the default mailclient by not
using the gui?

What I need to do, is to create Mozilla Thunderbird as a
selectable mailclient,

The installation of Mozilla Thunderbird will do this automatically.

and then select Mozilla Thunderbird as the default client.

Can anyone tell me how to do it (through registry, some api or ...)
- or point me to some documentation on how to do it?

This VBScript (.vbs) will set Mozilla Thunderbird as the default
e-mail client:

'--------------------8<----------------------

Set oShell = CreateObject("WScript.Shell")

sMailtoCmd = RegRead("HKLM\SOFTWARE\Clients\Mail\Mozilla Thunderbird" _
& "\protocols\mailto\shell\open\command\")

If sMailtoCmd <> "" Then
On Error Resume Next
oShell.RegDelete "HKEY_CLASSES_ROOT\mailto\EditFlags"
oShell.RegDelete "HKEY_CLASSES_ROOT\mailto\DefaultIcon\"
On Error Goto 0
oShell.RegWrite "HKEY_CLASSES_ROOT\mailto\", "URL:MailTo Protocol"
oShell.RegWrite "HKEY_CLASSES_ROOT\mailto\URL Protocol", ""
oShell.RegWrite "HKEY_CLASSES_ROOT\mailto\Shell\Open\Command\", sMailtoCmd

oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\", _
"Mozilla Thunderbird"

End If


Function RegRead(sRegValue)
Set oShell = CreateObject("WScript.Shell")
On Error Resume Next
RegRead = oShell.RegRead(sRegValue)
' If the value does not exist, error is raised
If Err Then
RegRead = ""
Err.clear
End If
' If a value is present but uninitialized the RegRead method
' returns the input value in Win2k.
If VarType(RegRead) < vbArray Then
If RegRead = sRegValue Then
RegRead = ""
End If
End If
On Error Goto 0
End Function

'--------------------8<----------------------


WSH 5.6 documentation (local help file) can be downloaded
from here if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp
 
Torgeir said:
The installation of Mozilla Thunderbird will do this automatically.


Are you sure? :-)

Offcource I know that .. but i'm creating a tweeked installation based
on the nightly .zip dumps of Thunderbird.
This VBScript (.vbs) will set Mozilla Thunderbird as the default
e-mail client:


Great .. It looks like the registry keys I needed. Thanks. I will try it
out.

Regards Søren
 
Soren said:
Are you sure? :-)

Offcource I know that .. but i'm creating a tweeked installation based
on the nightly .zip dumps of Thunderbird.

Is your Mozilla Thunderbird installation creating the registry key
with subkeys and values:
HKLM\SOFTWARE\Clients\Mail\Mozilla Thunderbird\
 
Reading varius documentation, registry capturing and your guys help - I
have created this .reg file that actually works better than the mess
that the Thunderbird installer creates:


Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\mailto]
@="URL:MailTo Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\mailto\DefaultIcon]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe,0"

[HKEY_CLASSES_ROOT\mailto\shell]

[HKEY_CLASSES_ROOT\mailto\shell\open]

[HKEY_CLASSES_ROOT\mailto\shell\open\command]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe -compose %1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail]
@="Mozilla Thunderbird"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla Thunderbird]
@="Mozilla Thunderbird"
"DLLPath"="C:\\Program Files\\Thunderbird\\mozMapi32.dll"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla Thunderbird\DefaultIcon]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe,0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla Thunderbird\Protocols]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\Protocols\mailto]
@="URL:MailTo Protocol"
"URL Protocol"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\Protocols\mailto\DefaultIcon]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe,0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\Protocols\mailto\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\Protocols\mailto\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\Protocols\mailto\shell\open\command]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe -compose %1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla Thunderbird\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla Thunderbird\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\shell\open\command]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe -mail"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\shell\properties]
@="Thunderbird &Options"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\shell\properties\command]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe -options"

[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla Thunderbird\Desktop]
"registeredAsMailApp"="1"
"defaultMailHasBeenSet"="0"
"showMapiDialog"="0"
 
After having read varius documentation, done some registry capturing and
listening to you guys - I have created this .reg file that actually
works better than the mess that the Thunderbird installer creates:


Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\mailto]
@="URL:MailTo Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\mailto\DefaultIcon]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe,0"

[HKEY_CLASSES_ROOT\mailto\shell]

[HKEY_CLASSES_ROOT\mailto\shell\open]

[HKEY_CLASSES_ROOT\mailto\shell\open\command]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe -compose %1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail]
@="Mozilla Thunderbird"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla Thunderbird]
@="Mozilla Thunderbird"
"DLLPath"="C:\\Program Files\\Thunderbird\\mozMapi32.dll"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla Thunderbird\DefaultIcon]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe,0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla Thunderbird\Protocols]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\Protocols\mailto]
@="URL:MailTo Protocol"
"URL Protocol"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\Protocols\mailto\DefaultIcon]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe,0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\Protocols\mailto\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\Protocols\mailto\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\Protocols\mailto\shell\open\command]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe -compose %1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla Thunderbird\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla Thunderbird\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\shell\open\command]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe -mail"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\shell\properties]
@="Thunderbird &Options"

[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Mozilla
Thunderbird\shell\properties\command]
@="C:\\Program Files\\Thunderbird\\Thunderbird.exe -options"

[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla Thunderbird\Desktop]
"registeredAsMailApp"="1"
"defaultMailHasBeenSet"="0"
"showMapiDialog"="0"
 
Torgeir said:
Is your Mozilla Thunderbird installation creating the registry key
with subkeys and values:
HKLM\SOFTWARE\Clients\Mail\Mozilla Thunderbird\

Yes. The installation creates this key.
 
Back
Top