MAPI error MAPI_E_NOT_SUPPORTED problem
-
Hello everybody! My working environment is: Windows 10, Visual Studio Community 2017 (and 2008 for older projects), programming takes place only in C/C++. I need my program to be able to send emails with a PDF file attachment. The easiest way to send emails is to use ShellExecute with the parameter "mailto:someone@mail.com ... etc". But this method does not allow you to transfer attachments. So I tried using MAPISendMail in a variety of variants found on the internet. Including [Programmatically adding attachments to emails](https://www.codeproject.com/Articles/12757/Programmatically-adding-attachments-to-emails) and many others. Almost all of them work fine on my computer. However, when I trying to send an email on another computer, it leads to an error in the MAPISendMail function MAPI_E_NOT_SUPPORTED (code 26). In this case, the MAPILogon(Ex) function is executed without errors. Both computers, mine and the other, are on the same network and use the same mail server and Outlook as the client for users. On the other computer send/receive of the emails works perfectly. I searched the Internet for a long time for an explanation of this error, but found nothing. A search on the site [CodeProject](www.codeproject.com) also did not give anything. Please explain me what this error means and how to fix it. Thank you very much!
-
Hello everybody! My working environment is: Windows 10, Visual Studio Community 2017 (and 2008 for older projects), programming takes place only in C/C++. I need my program to be able to send emails with a PDF file attachment. The easiest way to send emails is to use ShellExecute with the parameter "mailto:someone@mail.com ... etc". But this method does not allow you to transfer attachments. So I tried using MAPISendMail in a variety of variants found on the internet. Including [Programmatically adding attachments to emails](https://www.codeproject.com/Articles/12757/Programmatically-adding-attachments-to-emails) and many others. Almost all of them work fine on my computer. However, when I trying to send an email on another computer, it leads to an error in the MAPISendMail function MAPI_E_NOT_SUPPORTED (code 26). In this case, the MAPILogon(Ex) function is executed without errors. Both computers, mine and the other, are on the same network and use the same mail server and Outlook as the client for users. On the other computer send/receive of the emails works perfectly. I searched the Internet for a long time for an explanation of this error, but found nothing. A search on the site [CodeProject](www.codeproject.com) also did not give anything. Please explain me what this error means and how to fix it. Thank you very much!
-
Hello everybody! My working environment is: Windows 10, Visual Studio Community 2017 (and 2008 for older projects), programming takes place only in C/C++. I need my program to be able to send emails with a PDF file attachment. The easiest way to send emails is to use ShellExecute with the parameter "mailto:someone@mail.com ... etc". But this method does not allow you to transfer attachments. So I tried using MAPISendMail in a variety of variants found on the internet. Including [Programmatically adding attachments to emails](https://www.codeproject.com/Articles/12757/Programmatically-adding-attachments-to-emails) and many others. Almost all of them work fine on my computer. However, when I trying to send an email on another computer, it leads to an error in the MAPISendMail function MAPI_E_NOT_SUPPORTED (code 26). In this case, the MAPILogon(Ex) function is executed without errors. Both computers, mine and the other, are on the same network and use the same mail server and Outlook as the client for users. On the other computer send/receive of the emails works perfectly. I searched the Internet for a long time for an explanation of this error, but found nothing. A search on the site [CodeProject](www.codeproject.com) also did not give anything. Please explain me what this error means and how to fix it. Thank you very much!
We had similar problems (sending e-mails with attachments). But since all our customers use MS Outlook as a standard e-mail application, we just implemented the Outlook automation. So the problem was solved.
-
You need to examine the code that causes the error. That should give a clue as to why it occurs.
One of the simplest variants I taked from [Sending Email with MAPI](https://www.experts-exchange.com/articles/1820/Sending-Email-with-MAPI.html), "Attachment" example. It works perfectly on my computer, but cannot send email on other. My send mail code fragment is:
LHANDLE lhSession;
ULONG result = lpfnMAPILogOn(0, NULL, NULL, 0, 0, &lhSession);ULONG nSent = lpfnMAPISendMail(lhSession, 0, &MAPImsg, MAPI_LOGON_UI | MAPI_DIALOG, 0);
lpfnMAPILogOff(lhSession, 0, 0, 0);
Variable
result
is OK, butnSent
is MAPI_E_NOT_SUPPORTED (code 26). Complete example project there: [Probe3.7z - Google Drive](https://drive.google.com/file/d/1KUID\_xwJBdp8MJI8dXS5\_dxAo4DljP0b/view?usp=sharing). -
We had similar problems (sending e-mails with attachments). But since all our customers use MS Outlook as a standard e-mail application, we just implemented the Outlook automation. So the problem was solved.
Unfortunately, we do not use Outlook automation, we just have Microsoft Office installed with the Outlook mail program. In addition, it is important to me that my program can send an email from different computers. And finally I want to understand what's the matter here :-)
-
One of the simplest variants I taked from [Sending Email with MAPI](https://www.experts-exchange.com/articles/1820/Sending-Email-with-MAPI.html), "Attachment" example. It works perfectly on my computer, but cannot send email on other. My send mail code fragment is:
LHANDLE lhSession;
ULONG result = lpfnMAPILogOn(0, NULL, NULL, 0, 0, &lhSession);ULONG nSent = lpfnMAPISendMail(lhSession, 0, &MAPImsg, MAPI_LOGON_UI | MAPI_DIALOG, 0);
lpfnMAPILogOff(lhSession, 0, 0, 0);
Variable
result
is OK, butnSent
is MAPI_E_NOT_SUPPORTED (code 26). Complete example project there: [Probe3.7z - Google Drive](https://drive.google.com/file/d/1KUID\_xwJBdp8MJI8dXS5\_dxAo4DljP0b/view?usp=sharing). -
Hello everybody! My working environment is: Windows 10, Visual Studio Community 2017 (and 2008 for older projects), programming takes place only in C/C++. I need my program to be able to send emails with a PDF file attachment. The easiest way to send emails is to use ShellExecute with the parameter "mailto:someone@mail.com ... etc". But this method does not allow you to transfer attachments. So I tried using MAPISendMail in a variety of variants found on the internet. Including [Programmatically adding attachments to emails](https://www.codeproject.com/Articles/12757/Programmatically-adding-attachments-to-emails) and many others. Almost all of them work fine on my computer. However, when I trying to send an email on another computer, it leads to an error in the MAPISendMail function MAPI_E_NOT_SUPPORTED (code 26). In this case, the MAPILogon(Ex) function is executed without errors. Both computers, mine and the other, are on the same network and use the same mail server and Outlook as the client for users. On the other computer send/receive of the emails works perfectly. I searched the Internet for a long time for an explanation of this error, but found nothing. A search on the site [CodeProject](www.codeproject.com) also did not give anything. Please explain me what this error means and how to fix it. Thank you very much!
Hmmm, Have you checked to see if there is a mail client defined? What is the value of the registry key: HKEY_LOCAL_MACHINE\Software\Clients\Mail [Mapi32.dll Stub Registry Settings | Microsoft Docs](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/windowsmapi/mapi32-dll-stub-registry-settings)
-
Unfortunately, we do not use Outlook automation, we just have Microsoft Office installed with the Outlook mail program. In addition, it is important to me that my program can send an email from different computers. And finally I want to understand what's the matter here :-)
It is not a big problem to implement the Outlook automation: about two to three working days (including tests and reading documentation). The only problem I see is some of your customers may use some other (non-Outlook) mail-application, so my suggestion won't work for them.
-
Hmmm, Have you checked to see if there is a mail client defined? What is the value of the registry key: HKEY_LOCAL_MACHINE\Software\Clients\Mail [Mapi32.dll Stub Registry Settings | Microsoft Docs](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/windowsmapi/mapi32-dll-stub-registry-settings)
-
I checked the registry keys on both computers (on my working one and on the other one having problems with sending mail programmatically). They match.
Well, I can't think of anything else. You might have to debug this one. You can try [resetting the MAPI settings](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/windowsmapi/installing-or-restoring-the-mapi32-dll-stub) with Fixmapi. I think fixmapi.exe is in the systems32 folder.
-
Hello everybody! My working environment is: Windows 10, Visual Studio Community 2017 (and 2008 for older projects), programming takes place only in C/C++. I need my program to be able to send emails with a PDF file attachment. The easiest way to send emails is to use ShellExecute with the parameter "mailto:someone@mail.com ... etc". But this method does not allow you to transfer attachments. So I tried using MAPISendMail in a variety of variants found on the internet. Including [Programmatically adding attachments to emails](https://www.codeproject.com/Articles/12757/Programmatically-adding-attachments-to-emails) and many others. Almost all of them work fine on my computer. However, when I trying to send an email on another computer, it leads to an error in the MAPISendMail function MAPI_E_NOT_SUPPORTED (code 26). In this case, the MAPILogon(Ex) function is executed without errors. Both computers, mine and the other, are on the same network and use the same mail server and Outlook as the client for users. On the other computer send/receive of the emails works perfectly. I searched the Internet for a long time for an explanation of this error, but found nothing. A search on the site [CodeProject](www.codeproject.com) also did not give anything. Please explain me what this error means and how to fix it. Thank you very much!
I think you still need to confirm the Outlook and MAPI versions; if you're looking for differences between computers. [Choose a specific version of MAPI to load | Microsoft Docs](https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/how-to-choose-a-specific-version-of-mapi-to-load)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I