Mapi SendMail error at OutLook 2010 x64 RRS feed

  • Question

  • Hi Expert,

        I'm trying to test MAPI32 sendmail function on C# console application(platform is using x86). My sample program is working outlook express and outlook 2007. But I got below error when i open MS Outlook 2010 x64. I try to change registry setting also not work anymore. I look around internet i cannot find best solution. What i need to do for this case? Kindly please help to me.

    Error Code = - 2147500037
    Microsoft Office Outlook
    Either there is no default mail client or the current mail client cannot fulfill the messaging request.  Please run Microsoft Outlook and set it as the default mail client.

            [DllImport("MAPI32.dll", EntryPoint = "MAPILogon", CharSet = CharSet.Ansi)]
            public static extern UInt32 Logon(IntPtr ulUIParam, string lpszProfileName, string lpszPassword,
            UInt32 flFlags, UInt32 ulReserved, ref IntPtr lplhSession);

            [DllImport("MAPI32.dll", EntryPoint = "MAPISendMail", CharSet = CharSet.Ansi)]
            public static extern UInt32 SendMail(IntPtr lhSession, IntPtr ulUIParam,
            MapiMessage lpMessage, UInt32 flFlags, UInt32 ulReserved);

            [DllImport("MAPI32.dll", EntryPoint = "MAPILogoff", CharSet = CharSet.Ansi)]
            public static extern uint Logoff(IntPtr lhSession, IntPtr ulUIParam, uint flFlags, uint ulReserved);

                uint ulResult = 0;
                IntPtr hSession = IntPtr.Zero;
                uint ulFlags = MAPI.MAPI_LOGON_UI | MAPI.MAPI_NEW_SESSION;

                ulResult = MAPI.Logon(IntPtr.Zero, null, null, 0, 0, ref hSession);

    Best Regards,


    Make Simple & Easy

    Saturday, February 16, 2013 5:45 AM


All replies