Is there any UI in Windows 10 to change the current MAPI provider?
Asked Answered
O

1

6

I want to write a custom send mail handler for Windows, including a Simple MAPI provider.

On Windows, the current MAPI provider is stored in

HKCU/SOFTWARE/Clients/Mail

and

HKLM/SOFTWARE/Clients/Mail

(the former overriding the latter). But I found no Windows 10 UI to change this registry setting. In particular, when the user changes Settings -> Default apps -> Email, Windows changes the mailto association which is a separate setting, but the MAPI registry keys stay unchanged. Is there any way to change the MAPI provider or execute custom code when the user chooses a different default email app?

These are the registry keys I install to make my MAPI provider known to Windows:

HKLM\SOFTWARE\Classes\CustomMapi.Mailto Type="string" Value="URL:MailTo Protocol"/>
HKLM\SOFTWARE\Classes\CustomMapi.Mailto Name="URL Protocol" Type="string" Value=""/>
HKLM\SOFTWARE\Classes\CustomMapi.Mailto\DefaultIcon Type="string" Value="[TARGETDIR]mailtohandler.exe,-1"/>
HKLM\SOFTWARE\Classes\CustomMapi.Mailto\shell\open\command Type="string" Value='"[TARGETDIR]mailtohandler.exe" "%1"'/>
HKLM\SOFTWARE\RegisteredApplications Name="CustomMapi" Type="string" Value="SOFTWARE\Clients\Mail\CustomMapi\Capabilities"/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi Type="string" Value="CustomMapi"/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi Name="DllPath" Type="string" Value="[TARGETDIR]custommapi.dll"/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi\Capabilities Name="ApplicationName" Type="string" Value="CustomMapi"/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi\Capabilities Name="ApplicationDescription" Type="string" Value="A custom MAPI provider."/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi\Capabilities\StartMenu Name="Mail" Type="string" Value="CustomMapi"/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi\Capabilities\URLAssociations Name="mailto" Type="string" Value="CustomMapi.Mailto"/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi\DefaultIcon Type="string" Value="[TARGETDIR]mailtohandler.exe,-1"/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi\Protocols\mailto Type="string" Value="URL:MailTo Protocol"/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi\Protocols\mailto Name="EditFlags" Type="integer" Value="2"/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi\Protocols\mailto Name="URL Protocol" Type="string" Value=""/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi\Protocols\mailto\DefaultIcon Type="string" Value="[TARGETDIR]mailtohandler.exe,-1"/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi\Protocols\mailto\shell\open\command Type="string" Value='"[TARGETDIR]mailtohandler.exe" "%1"'/>
HKLM\SOFTWARE\Clients\Mail\CustomMapi\shell\open\command Type="string" Value='"[TARGETDIR]mailtohandler.exe"'/>
Olly answered 24/1, 2019 at 12:32 Comment(0)
M
2

Since I didn't find the GUI myself I did put some simple powershell one together. You can check it here https://github.com/schtritoff/SetDefaultMAPIClient

Also, if you want to use MAPI from your WinForms app to precreate email in default MAPI email client you can use this library https://github.com/PandaWood/Simple-MAPI.NET#should-i-use

Mixon answered 23/10, 2021 at 14:47 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.