Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize


SQL Server 2000

  New Information - SQL Server 2000 SP3.

Deletes a message from the Microsoft® SQL Server™ inbox. xp_deletemail is used by sp_processmail to process mail in the SQL Server inbox.


xp_deletemail {'message_number'}



Is the number (assigned by xp_findnextmsg) of the mail message in the inbox that should be deleted. message_number is varchar(255), with no default.

Return Code Values

0 (success) or 1 (failure)

Result Sets

xp_deletemail returns this result set when passed a valid message ID.

The command(s) completed successfully.

Any failure except an invalid parameter is logged to the Microsoft Windows NT® application log.

xp_deletemail deletes message, but does not delete any attachments. You must delete attachments manually. You can suppress the generation of attachments by setting the suppress_attach parameter for xp_readmail to TRUE. For more information about security issues with attachments, see xp_readmail.

xp_deletemail does not keep a log of deleted messages or users who deleted the messages. This may cause auditing problems in an environment where several users have permission to execute xp_deletemail. To minimize this problem, limit permissions for xp_deletemail to members of the sysadmin fixed server role.


Execute permissions for xp_deletemail default to members of the sysadmin fixed server role but can granted to other users. However, for security reasons, you should limit permissions for this stored procedure to members of the sysadmin fixed server role.


This example deletes the message ID supplied from xp_findnextmsg. The value from xp_findnextmsg is placed in the local variable @message_id.

DECLARE @message_id varchar(255)
SET @message_id = 'XA17' -- Setting to a value would go here.
USE master
EXEC xp_deletemail @message_id

See Also


System Stored Procedures (SQL Mail Extended Procedures)






© 2015 Microsoft