xp_sendmail Fails with Mail Error 0x80004005 if active mail session with Exchange server was broken

Article translations Article translations
Article ID: 555180 - View products that this article applies to.
Author: Dmitry Korolyov MVP
Expand all | Collapse all

SYMPTOMS

When you use xp_sendmail extended stored procedure to send e-mail from SQL Mail with SQL Server 2000, you might receive the following error message:
 
Server: Msg 18025, Level 16, State 1, Line 0
xp_sendmail:failedwithmailerror 0x80040005
 
You receive the same error message if you use SQL Server Agent to send email messages. However, when you use the Microsoft Outlook client on a computer that is running SQL Server (and Outlook is configured with the same MAPI profile as SQL Mail), the delivery of messages is not affected and you can successfully send e-mail.

CAUSE

You can experience problems described in the "Symptoms" section of this article if connection to the Microsoft Exchange server was broken during active SQL Mail session. The connection could be broken due to a sudden loss of network connectivity with an Exchange server or because of other network problems. As a result, an invalid SQL Mail session is left on an SQL Server, and SQL Server attempts to utilize it for xp_sendmail calls. Since the mail session is invalid, an error is returned.

RESOLUTION

To fix the problem without restarting the SQL Server service, you may manually stop the invalid mail session. To do so, connect to the SQL server with Microsoft SQL Server Query Analyzer or similar utility using an account with sysadmin privileges, and run the following command:
 
exec master.dbo.xp_stopmail
 
This will force the broken mail session to quit and allow new sessions to be successfully created during xp_sendmail calls.

MORE INFORMATION

For additional information, click the following article numbers to view information in the Microsoft Knowledge Base:
 
820220 PRB: 0x80070005 or 0x80040005 Error Occurs When You Send E-Mail by Using the Xp_sendmail Extended Stored Procedure
811035 PRB: The xp_sendmail Stored Procedure Fails with Error 0x80070005 When the Mailbox of the SQL Mail Profile is Different From the MSSQLServer ServiceStartup Domain Account Default Mailbox
293422 PRB: xp_sendmail Using a Microsoft Exchange 2000 Mailbox Fails with Mail Error 0x80004005 or 0x80007005

Properties

Article ID: 555180 - Last Review: August 19, 2004 - Revision: 1.0
APPLIES TO
  • Microsoft SQL Server 2000 Standard Edition
Keywords: 
kbpubtypecca kbpubmvp kbhowto KB555180
COMMUNITY SOLUTIONS CONTENT DISCLAIMER
MICROSOFT CORPORATION AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY, RELIABILITY, OR ACCURACY OF THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN. ALL SUCH INFORMATION AND RELATED GRAPHICS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMATION AND RELATED GRAPHICS, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, TITLE AND NON-INFRINGEMENT. YOU SPECIFICALLY AGREE THAT IN NO EVENT SHALL MICROSOFT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OF OR INABILITY TO USE THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF MICROSOFT OR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES.

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com