SQL Mail (“xp_sendmail: failed with mail error 0x80040111”.) RRS feed

  • Question




    I have sql server 2000 with sp2  on Win 2003 enterprise edition SP2 box and Outlook 2003 client. Whenever i execute Xp_sendmail procedure i get this error :-

    xp_sendmail: failed with mail error 0x80040111


    If we test the SQL mail through the entrprise manager the error is:-


    Error:18025: Xp_test_mapi_profile: Failed with mail error: 0x80040111.


    The outlook profile is configured fine , i am able to send mail through outlook from the same server.

    My Sql server agent service uses the same account for startup.


    Please let me know if any thing else need to be checked.






    Wednesday, November 14, 2007 12:03 PM

All replies

  • Hi,


    If its any consolation, we having the same error now having been able to execute xp_sendmail in the past. Jobs from SQL agent are still able to fire notification but if I try to execute from SP or trigger it return same error.


    I have checked BOL but nothing concreate


    Any ideas?





    EXEC dbo.xp_sendmail '*********.com' ,

    @message = ' Testing mail service please ignore!'

    Thursday, January 31, 2008 10:08 AM
  • Is the Outlook profile that you created for the domain user account that the SQL Server Agent runs as? Can you log onto Windows Server as that domain user and send email using that profile?

    Check out these links:



    Friday, February 1, 2008 1:59 PM
  • We're having exactly the same issue -- Windows 2003 with SQL Server 2000 SP2.  We run under an account named "SqlService".  I can log in and send mail all day with this account, but SQL Mail throws up the error above.   


    This was working before last Monday morning after the database server was rebooted for the first time in a couple months.

    Wednesday, September 29, 2010 3:43 PM
  • did you try running xp_stopmail and then xp_startmail?

    Pradeep Adiga
    My blog: http://www.sqldbadiaries.com

    Recent posts on my blog
    Wednesday, September 29, 2010 7:48 PM
  • Hi,

    As per KB http://support.microsoft.com/kb/238119 Error Code: 0x80040111 means MAPI_E_LOGON_FAILED which means its Authentication issue. It seems SQL AGENT Mail was not able to talk to Exhange Server. Issue is not there on Exchange Part as you mentioned that you are able to send emails thry OUTLOOK. Now what I recommend is to follow below steps:

    -> Log on tho the server using SQL Server domain account . 
    -> Log on to the server >> created a new profile >> Changed the SQL Agent setting to point to that profile (which was now visible..wow).
            -> Started the mail session using xp_startmail.
                    SQL Mail session started.
            -> Sent a test mail : xp_sendmail 'xxxx@xx.com','test'
                    We should get -> Mail sent message.

    Please check this and update if it works.



    Regards Gursethi Blog: http://ms-gursethi.blogspot.com/ +++++++++++++++++++++++++++++++++++++++++++++++++++++++ Please mark "Propose As Answer" if my answer helped..... :)
    Friday, October 1, 2010 5:17 AM
  • Well if you think you have all setup correctly including exchange profile, SQL agent and server profile in sync then just stop the mail and start it back. using xp_stopmail and xp_startmail commands. It works.



    Friday, January 7, 2011 11:58 AM
  • I solved the same issue by installing SQL Server 2000 SP4 and Outlook 2003 as MAPI client (in cache mode).



    Monday, October 3, 2011 9:55 PM
  • xp_sendmail is deprecated http://msdn.microsoft.com/en-us/library/ms189505(v=sql.105).aspx

    Instead, please use Database Mail http://msdn.microsoft.com/en-us/library/ms175887(v=sql.105).aspx


    Sethu  Srinivasan  [MSFT]

    SQL Server


    Tuesday, August 14, 2012 9:23 PM