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"'/>