Accepts a message ID for input and returns the message ID for output. This extended stored procedure is used with the sp_processmail system stored procedure in order to process mail in the SQL Server inbox.
xp_findnextmsg [@msg_id = msg_id [OUTPUT]]
[, @type = type]
[, @unread_only = {'true' | 'false'}])
where
IP[M | C].Vendorname.subclass
Message types beginning with IPM will appear in the inbox of the mail client, and will be found or read by xp_findnextmsg if the @type is NULL. 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.
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.
This example returns the status when searching for the next message ID (for only unread messages). In this example, the value from xp_findnextmsg is placed in a local variable named @message_id.
EXEC @status = xp_findnextmsg @msg_id = @message_id OUTPUT
Execute permission defaults to the system administrator, who can grant permission to other users.
sp_processmail | xp_sendmail |
xp_deletemail | xp_startmail |
xp_readmail | xp_stopmail |