xp_deletemail Extended Stored Procedure

Deletes a message from the SQL Server inbox. This procedure is used by the sp_processmail system stored procedure to process mail in the SQL Server inbox.

Syntax

xp_deletemail [@msg_id = ] msg_id

where

@msg_id = msg_id
Specifies the ID (as assigned by xp_findnextmsg) of the mail message in the inbox that should be deleted.

Remarks

This extended stored procedure returns a successful (0) or failed (1) status. Any failure except an invalid parameter is logged to the Windows NT application event log.

Example

This example deletes the message ID as supplied from xp_findnextmsg. In this example, the value from xp_findnextmsg is placed in a local variable named @message_id.

xp_deletemail @message_id

Permission

Execute permission defaults to the system administrator, who can grant permission to other users.

See Also

sp_processmail xp_sendmail
xp_findnextmsg xp_startmail
xp_readmail xp_stopmail