Guest Posted March 20, 2021 In Winapi.MAPI there is the InitMapi method called before a lot of operations. I have traced into that method from TSendMail.Execute. The method tries to read some registry keys but fails. I have checked another MAPI implementation i have access to, the one in madExcept. That exact registry check can be found there to, but it's commented out (!). I have been googling but there's so much noise! Is it a VCL (Vcl.ExtActns/Winapi.MAPI units) bug? TIA, /Dany Share this post Link to post
Attila Kovacs 631 Posted March 20, 2021 What is the error you encounter? Share this post Link to post
Guest Posted March 20, 2021 It seems newer Windows installations (?) does not have that registry value: InitMapi @445 if RegQueryValueEx(hkWMS, 'MAPI', nil, @rType, @MAPIValueBuf, @MAPIValueSize) <> ERROR_SUCCESS then Exit; Always fails, so nothing happens. Share this post Link to post
Attila Kovacs 631 Posted March 20, 2021 do you want to try my mapi unit? Share this post Link to post
Attila Kovacs 631 Posted March 20, 2021 Use it as you want if it works. I'd be happy if fixes/enhancements would come back to me! 😉 forsix.MapiMail.pas 1 1 Share this post Link to post
Guest Posted March 20, 2021 Looks much cleaner than other implementations. I'll keep fiddling with this. Thanks! /D Share this post Link to post
Guest Posted March 20, 2021 IMHO, you implementation is much more readable. I have successfully managed to have Outlook throw up a mail dialog with a HTML body 🙂 I do not think (except for the VCL registry check) that the other implementations are worse but it was easier to try different things using your unit. Thanks! Aside; I'm still a bit confused; on the net most posts states that you cannot do formatted mails with Simple MAPI. It should be possible with Extended MAPI. Perhaps there's three APIs? Anyways the "Simple MAPI Trick" to attach only one the html file seems to work. Share this post Link to post
Attila Kovacs 631 Posted March 20, 2021 (edited) I'm glad if it works. I don't know every implementation but I could not find any which supports unicode for example, so I made my own. Also, you can have multiple attachments. Edited March 20, 2021 by Attila Kovacs Share this post Link to post
Vandrovnik 215 Posted May 24, 2021 On 3/20/2021 at 1:37 PM, Attila Kovacs said: Use it as you want if it works. I'd be happy if fixes/enhancements would come back to me! 😉 forsix.MapiMail.pas Thank you for the unit! I have found a bug regarding attachments in mvAnsi mode (two times there should be TMapiFileDesc instead of TMapiFileDescW; ^ is missing in FillChar). Original code: if LAttachCount > 0 then begin GetMem(LAttachments, SizeOf(TMapiFileDescW) * LAttachCount); FillChar(LAttachments, SizeOf(TMapiFileDescW) * LAttachCount, 0); Please change to: if LAttachCount > 0 then begin GetMem(LAttachments, SizeOf(TMapiFileDesc) * LAttachCount); FillChar(LAttachments^, SizeOf(TMapiFileDesc) * LAttachCount, 0); I have also added a simple procedure SetMapiDll (on clients computers, GroupWise is installed and used. Outlook 2019, which is also installed, but not used, keeps overwriting the registry entry, so I will probably have to load directly C:\Program Files (x86)\Novell\GroupWise\gwmlt1.dll there). procedure SetMapiDll(const AMapiDll: string); begin MAPIDLL:=aMapiDll; end; 1 Share this post Link to post
Attila Kovacs 631 Posted May 24, 2021 @Vandrovnik Thank you for pointing that out! Share this post Link to post
Vandrovnik 215 Posted May 26, 2021 On 5/24/2021 at 9:48 PM, Attila Kovacs said: @Vandrovnik Thank you for pointing that out! There is another small one (missing "W"), which probably makes no problem now: in mwWide, original code: FillChar(LMapiMessageW, SizeOf(LMapiMessage), 0); please change to FillChar(LMapiMessageW, SizeOf(LMapiMessageW), 0); Share this post Link to post
Guest Posted May 26, 2021 @Attila Kovacs perhaps its time to put it up on git? What do you think? I have had benefits from the unit. And i would guess other will. Share this post Link to post
Attila Kovacs 631 Posted May 26, 2021 @Vandrovnik Thx, damn copy paste devil 😉 @Dany Marmur and who should maintain it? I've no time for that. Share this post Link to post
Vandrovnik 215 Posted May 27, 2021 Emba could also repair their implementation... Share this post Link to post
Attila Kovacs 631 Posted May 27, 2021 9 hours ago, Vandrovnik said: Emba could also repair their implementation... They won't as MAPI is officially discontinued. I'll put it on github though. Share this post Link to post
marcin 0 Posted December 24, 2021 Hi Is there a place where latest version of the unit is available? I'm facing similar issues on newer windows 10 machines where attemp of sending a message via MAPI return MAPI error. Old machines with updated Win10 work perfectly. Thanks in advance Merry Christmas / Happy Holidays M. Share this post Link to post
Attila Kovacs 631 Posted December 24, 2021 I did not change anything since then. However I'm starting to encounter problems with Thunderbird too. Sometimes it just hangs and returns with unknown error. forsix.MapiMail.pas Share this post Link to post
Guest Posted December 25, 2021 On 5/27/2021 at 8:54 PM, Attila Kovacs said: They won't as MAPI is officially discontinued. What are the alternatives? One bridge for each plausible e-mail client? The sharing concept seems not to interact with an e-mail client (please correct me if i am wrong!). Thanks again for the unit @Attila Kovacs! Share this post Link to post
ConstantGardener 31 Posted February 27, 2022 @Attila Kovacs Thank you for the unit! 1 Share this post Link to post
marcin 0 Posted April 26, 2022 @Attila Kovacs Thanks for sharing the unit - it works in environments where other solutions have failed. I'd like to ask if it possible to prepare body of the message as html. I've read the unit couple of times, but I have not found the way. TIA Marcin Share this post Link to post
Attila Kovacs 631 Posted April 26, 2022 @marcin thank you for the feedback, as for thunderbird just pass the html text as the body. Don't forget to inline the images, and keep them in one single line. For Outlook you have to test for yourself as I do not have any here. There are rumors on the net that body should be null and the first and only attachment should be html body but I hope it's not the case anymore. Share this post Link to post
marcin 0 Posted April 26, 2022 @Attila Kovacs Thanks a lot for promtp response I have tested with my email app - I use eM Client - and it did not work, but I will check tomorrow on other workstation. I need it working just with thunderbird. Marcin Share this post Link to post
Attila Kovacs 631 Posted April 26, 2022 26 minutes ago, marcin said: I use eM Client - and it did not work I see. I've installed it now and the whole html is inserted as text. Sadly, there is not much we can do in simple mapi. You could ask them in their forum to implement it. Share this post Link to post