How to send a mail using MAPI?

16,380

I have solved this by my own, with the help from various internet sources.

Official MSDN documentation

MAPIEx: Extended MAPI Wrapper

Once the code is properly tested & documented, I will try to post it here for future reference.

Share:
16,380
Lundin
Author by

Lundin

Codidact account: https://software.codidact.com/users/8176. I consent to have any content written by me on the Stack Exchange network to get migrated to Codidact, with attribution given.

Updated on June 04, 2022

Comments

  • Lundin
    Lundin almost 2 years

    I want to send an e-mail using the mail client on the user's Windows computer. As far as I can tell from the net, MAPI is the way to go. However, after reading through the MSDN documentation, I find out that MAPI is quite vast, with no source code examples. And I have no need for 99% of the features, I just want to send an e-mail. How do I do this?

    I have found examples here on SO and on the web, but they seem to rely on something called Simple MAPI, which Microsoft has apparently listed as obsolete: "The use of Simple MAPI is discouraged. It may be altered or unavailable in subsequent versions of Windows". So I don't want to use those functions.

    I found a very good example here, but unfortunately it is for Windows CE and isn't fully compatible with the Win32 API. I managed to implement the code from that link until it got to where it attempts to open the drafts folder, the parameters to GetProps aren't compatible. Does anyone know where I can find a similar code example for PC? C++ prefered.