Reputation: 1580
I have some code that sends emails using the default email client on windows.
If it's Outlook, I'll use the "Outlook.Application" ole object, otherwise I'll fall back to MAPI. This has been in use at multiple sites for several years, but now it is not working for a new client.
/* Pseudocode Delphi */
client = HKEY_CURRENT_USER\Software\Clients\Mail
if client='' then client=HKEY_LOCAL_MACHINE\Software\Clients\Mail
if pos('Outlook',client)>0 then useoutlook:=true;
if useoutlook then OutApp:=CreateOleObject('Outlook.Application');
else UseMapi
There are two problems with this approach using Win 10 and Outlook 2016 MSO (16.0.11901.20070) 32 bit
I've found some clues online indicating that MAPI in outlook relies on the Outlook.Application OLE.
I just need to either know how for force it to install the OLE class, OR register it properly for MAPI, OR to know if it's no longer supported and I need to find a different solution.
All I'm trying to do is to send an email with a pdf attachment. I found that Outlook's MAPI support seemed a little flakey and I was better off using the OLE, but if it's no longer supported or needs extra steps, I need to know.
If anyone has any detail on PackagedMail, that would be a bonus.
Upvotes: 0
Views: 1106
Reputation: 1580
Partial answer which resolved my immediate problem:
The Delphi Winapi.Mapi unit checks the registry to see if MAPI is installed:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem
MAPI="1"
This was clearly visible and populated in Regedit, but not visible to Delphi due to Registry Redirection
The actual registry key that 3 2bit applications see is stored here:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows Messaging Subsystem
which was NOT populated for some reason. Manually adding MAPI="1" into the WOW6432Node entry made the MAPI features start working again.
This still doesn't answer my actual question, but I thought it worth documenting.
NOTE: The MAPI value is a REGSZ (String) type.
Upvotes: 1