Home > Software design >  Is there a way to force a mailto to launch Outlook (despite the default Email app setting in windows
Is there a way to force a mailto to launch Outlook (despite the default Email app setting in windows

Time:10-23

I have a link in a web app that uses mailto: to launch an email (with default values for To, Subject, and Body). That said, when this link is clicked by an end user, it opens with whatever default Email app they have setup in Windows. All of my end users have Outlook, and some have (likely unintentionally) selected values other than Outlook as their default Email app. This became apparent, this morning, when one of my end users complained and I found their default Email app was simply Chrome.

Is there a way to force the mailto: command to launch Outlook despite the end users default Email app value?

CodePudding user response:

It is not a good idea but you can force another application assuming it is also registered as some type of protocol/file handler.

Use ShellExecuteEx with SEE_MASK_CLASSNAME or SEE_MASK_CLASSKEY and lpClass/hkeyClass to the applications progid under HKEY_CLASSES_ROOT (Outlook.xyz or something like that).

See also:

CodePudding user response:

There is no way to force a specific email client on the end-user machine using the mailto protocol. Read more about possible parameters for the mailto protocol in MSDN or MDN.

You may consider automating Outlook from a web browser, but only Internet Explorer understands and aware about COM automation. Other web browsers can't use automation and is not aware about COM for security reasons.

  • Related