xp_deletemail

Transact-SQL Reference

Transact-SQL Reference

xp_deletemail

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

Syntax

xp_deletemail {'message_number'}

Arguments

'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.
Remarks

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

Permissions

Execute permissions for xp_deletemail default to members of the sysadmin fixed server role but can granted to other users.

Examples

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

sp_processmail

System Stored Procedures (SQL Mail Extended Procedures)

xp_findnextmsg

xp_readmail

xp_sendmail

xp_startmail

xp_stopmail