ShellExecute starts Outlook Express under Citrix when Outlook is default

dds_felles used Ask the Experts™
I'm using ShellExecute to start Outlook. The code works fine under Windows, but when running under Citrix MetaFrame Outlook Express starts instead of Outlook - this despite the fact that Outlook is defined as the default e-mail program.

(When Outlook Express starts the first message that appears is "Outlook Express is not currently your default mail client. Would you like to make it your default mail client?")

My question therefore is: why does Outlook Express start when I don't specify which program to start in the call to ShellExecute and Outlook (not Outlook Express) is defined as my default mail client?
NOTE: This is PowerBuilder code
Public Function Long ShellExecute(Long hWnd, String lpOperation, String lpFile, String lpParameters, String lpDirectory, Long nShowCmd) Library "shell32.dll" Alias For "ShellExecuteW"
ShellExecute(0, "", "mailto:" + ls_mail_to + "?subject=" + ls_subject + "&body=" + ls_body, "", "", SW_SHOWNORMAL)

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Carl WebsterCitrix Technology Professional - Fellow
Top Expert 2010



The source of the problem appears to be in the registry. It seems that ShellExecute doesn't in fact start the "default" e-mail client - it starts the program specified by the resigstry key:


In Windows this was set to Outlook, but on the Citrix server the setting was Outlook Express.

I used a MAPI solution earlier, but the problem with MAPI is that it doesn't appear provide the ability to view the e-mail before sending (which ShellExecute does through the SW_SHOWNORMAL parameter).

It is an absolute requirement that the users are able to see (and edit) the mail message before it is sent.
Daniel BorgerSenior Citrix Engineer- CCEE

Is this a 64 bit server?
I used this in place of the "send to" on the desktops to resolve a smiular issue.  perhaps you could use this vbs
set objArgs = WScript.Arguments
Set objOutlook=CreateObject("Outlook.Application")
Set objMessage=objOutlook.CreateItem(0)
 For each strArg in objArgs

Not sure if server is 64 bit or not.

The application in question is written in PowerBuilder so I can't use the given code directly, however I have previously tried the PowerBuilder equivalent - but only ShellExecute starts Outlook if it isn't running and also displays the mail message for updating before sending.

I have now altered the registry key HKEY_CLASSES_ROOT\mailto\shell\open\command on the Citrix server to start Outlook instead of Outlook Express and this has solved the problem.

I recommend using the SMTP model over MAPI unless you don't mind dealing with the Outlook Model Guard which pops up the messagebox a user must acknowledge after 5 seconds to send or deny the email.  Unless of course you want that feature.  I know for me it was causing issues for our automated tasks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial