I want to allow users to send a file from within my UWP app through their default email client. Currently, there is no way for UWP apps to attach files to any other email client besides Windows Mail. So, with that restriction, the next best thing I can do is determine which email client is set as default, and if it isn't Windows Mail, I can notify the user that they need to change their default or attach the file manually.
The standard way to get this information appears to be through Win32.Registry. There's a number of different places people have been pointing me to, but none of them appear to consistently hold the correct data (or even exist at all).
From this post:
HKEY_CURRENT_USER\Software\Clients\Mail
-> Doesn't exist
HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail
-> Is stuck as Microsoft Outlook, as described by this post.
From this post:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\mailto\shell\open\command
-> Fixed as "C:\Program Files\Microsoft Office\Root\Office16\OUTLOOK.EXE" -c IPM.Note /mailto "%1"
HKEY_CURRENT_USER\SOFTWARE\Classes\mailto
-> No data
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\mailto
-> No data
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Roaming\OpenWith\UrlAssociations\mailto
-> No data
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\mailto\UserChoice\ProgId
-> This is the only value that updates when I change the default mail client. Here are some of the values:
Windows Mail: AppXydk58wgm44se4b399557yyyj1w7mbmvd
Outlook: Outlook.URL.mailto.15
Chrome: ChromeHTML
However, this location appears to require the user to run the app as an administrator, or else it throws an error.
Are any of these values consistent? Could I check in the app for this Windows Mail ProgId value, or does it totally vary by device? Is there somewhere else I should be looking, or a different approach I should be taking?
Thank you!