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