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'}
0 (success) or 1 (failure)
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.
Execute permissions for xp_deletemail default to members of the sysadmin fixed server role but can granted to other users.
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
sp_processmail | xp_startmail |
xp_findnextmsg | xp_stopmail |
xp_readmail | System Stored Procedures (SQL Mail Extended Procedures |
xp_sendmail |