xp_stopmail (Transact-SQL)

Stops a SQL Mail client session. Stopping a mail session opens the MAPI client components and logs off of the e-mail server.


This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

Topic link iconTransact-SQL Syntax Conventions



Return Code Values

0 (success) or 1 (failure)

Result Sets

xp_stopmail returns this message:

Stopped SQL mail session.


If there is no existing SQL Server mail session to stop, an error message is returned.


Requires membership in the sysadmin fixed server role, but EXECUTE permission can be granted to other users. However, for security reasons, we recommend that permissions for this stored procedure be limited to members of the sysadmin fixed server role.