INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Detect/Determine Default Email Pgm/Application on Windows 7

Detect/Determine Default Email Pgm/Application on Windows 7

(OP)
Hi,

Trying to determine what Email Program is configured in Windows 7 as the Default Email Program.
Have tried checking the Registry Keys but having very inconsistent results.
The inconsistency is not with the PB code, it's with the registry Keys.
RegistryGet("HKEY_CURRENT_USER\Software\Clients\mail",',RegString!, ls_email)
* Tried this code for each of the keys listed below.
Code works fine to get the key value, problem is the key is not always there - see HKEY_CURRENT_USERS.

On one Win 7 PC, Lotus Notes and Outlook both have been installed.
User A has MS Outlook set as Default Email Program.
User B has Lotus Notes set as Default Email Program.

PC #1 [2 user accounts, each has different default email pgm]
Registry: [NOTE: Registry Keys viewed while signed in as user B]
HKEY_CLASSES_ROOT\mailto\shell\open\command: [Microsoft Outlook]
I also checked the following:
HKEY_LOCAL_MACHINE\Software\Clients\mail: [Microsoft Outlook]
* I don't think these are right. User B has Lotus Notes set as Default Email Pgm and never opened Outlook, but the fact is these might not be user specific. Decided to look at USER keys.
HKEY_CURRENT_USER\Software\Clients\mail: [Lotus Notes]
* This was encouraging.

However, on the other machine which only has had Lotus Notes installed/configured, there isn't even a Clients section under HKEY_CURRENT_USER\Software\ so I guess I can't use that key.
PC #2 [one user account, one email pgm]
Registry:
HKEY_LOCAL_MACHINE\Software\Clients\mail: [Lotus Notes]
HKEY_CURRENT_USER\Software\Clients\mail:
* Key Does not exist. Clients section doesn't exist either.

- See attached screen shot of registry
http://files.engineering.com/getfile.aspx?folder=2...

I appreciate any recommendations or findings on a consistent way/key to determine the Default Email Program based on the current logged in User on windows 7.

Thanks.

RE: Detect/Determine Default Email Pgm/Application on Windows 7

(OP)
I figured out a workaround for this in case anybody else runs into this inconsistency with the registry concerning the Default Email Client.

Background:
Registry Key HKCR\mailto\shell\open\command does not return consistent results. On a PC where both Outlook and Lotus Notes were installed, it indicated Outlook even when Lotus Notes was set as the Default. Discovered that in this case, HKCU\Software\Clients\mail contained the correct 'Lotus Notes' value.
However, it was also discovered that this key is also not reliable [by itself]. On another PC, with only Lotus Notes configured, this key did not exist. The [HKCR mailto command] key did, however, contain the correct value [Lotus Notes] in this case.

Pseudo-Code
Decided to use a 2 tiered approach to the registry check.

IF HKCR\mailto\shell\open\command is 'Outlook' THEN
check HKCU\Software\Clients\mail
and use its value as the Default Email Client.
ELSE If HKCR\mailto\shell\open\command is 'Lotus Notes' THEN
no need to go further
Use Lotus Notes Email Client
END ID


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close