Accepts a message ID for input and returns the message ID for output. xp_findnextmsg is used with sp_processmail in order to process mail in the Microsoft® SQL Server™ inbox.
xp_findnextmsg [[@msg_id =] 'message_number' [OUTPUT]]
[,[@type =] type]
[,[@unread_only =] 'unread_value'])
IP[M | C].Vendorname.subclass
If type is NULL, message types beginning with IPM appear in the inbox of the mail client and are found or read by xp_findnextmsg. Message types beginning with IPC do not appear in the inbox of the mail client and must be found or read by setting the type parameter. The default is NULL.
0 (success) or 1 (failure)
xp_findnextmsg 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_findnextmsg default to members of the sysadmin fixed server role but can be granted to other users.
This example retrieves the status when searching for the next message ID (for only unread messages). The value from xp_findnextmsg is placed in the local variable @message_id.
DECLARE @status int, @message_id varchar(255)
-- SET @status = value would be here.
-- SET @message_id = value would be here.
EXEC @status = xp_findnextmsg @msg_id = @message_id OUTPUT
sp_processmail | xp_startmail |
xp_deletemail | xp_stopmail |
xp_readmail | System Stored Procedures (SQL Mail Extended Procedures) |
xp_sendmail |