MAPISendMail Fails (returns MAPI_E_FAILURE when outlook is running) RRS feed

  • Question

  • Hi,

    I am having an MFC application which gets launched as "Run as Administrator".
    In this application I am using "MAPISendMail" to send a mail from the outlook.

    When I am launching outlook in the admin mode I am able to send a mail from outlook using "MAPISendMail" as
    both MFC application and outlook are running at same privilege level(i.e admin mode).

    When I am launching outlook as standalone user mode and now if try sending mail from outlook using "MAPISendMail"
    from the MFC application(which is being run as admin) it is failing.

    The link I took reference to use MAPISendMail is: MAPISendMail

    I searched alot and someone suggested to create a new process and call MAPISendMail so that it launches outlook. But I could not get how does I do this.

    Could anyone please help to resolve this issue probably with a code snippet.


    Friday, March 10, 2017 9:00 AM

All replies

  • Hi,

    I am trying to send an email using a c++application where I loaded MAPI32.dll first and then tried accessing the MAPISendMail with the necessary parameters being passed. When I tried to execute this step it throwing an exception "Access violation..". When I click continue then it throws "MAPI_E_FAILURE" error  code. But the same piece of code works fine in windows 7 and outlook 2013.

    The environment I am using is windows 10 and outlook 2016 and issue exists in this os with outlook 2016.

    I could not trace out what exactly is the issue. It would be greatly appreciate if any one could help me.




    Wednesday, March 8, 2017 11:52 AM
  • Hi SivaV,

    In fact, about Outlook development issue, you’d better ask for help from Microsoft Office for Developers forum, I search resources for you here and find out this case, I think the solution here can give you a hint.

    The reason for the behavior is the security context of the calling application is at a higher privilege level than the code its calling into. This is prohibited by the UAC system. You should consider running your code at the same privilege level as Outlook.

    Problem with outlook and MAPISendMail (returns MAPI_E_FAILURE when outlook is running)


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Thursday, March 9, 2017 5:53 AM
  • The ExecInExplorer sample demonstrates how to start an unelevated application from an elevated process.

    Friday, March 10, 2017 11:12 AM