(Windows only) Reads a message from the SAP ASE message inbox.
xp_readmail [msg_id] [, recipients output] [, sender output] [, date_received output] [, subject output] [, cc output] [, message output] [, attachments output] [, suppress_attach = {true | false}] [, peek = {true | false}] [, unread = {true | false}] [, msg_length output] [, bytes_to_skip [output]] [, type [output]]
declare @msgid binary(255) declare @originator varchar(20) declare @mess varchar(255) exec xp_findnextmsg @msg_id = @msgid output exec xp_readmail @msg_id = @msgid, @sender = @originator output, @message = @mess output
declare @msgid binary(255) declare @mess varchar(255) declare @msg_length char(255) declare @len int declare @skip int exec xp_findnextmsg @msgid output exec xp_readmail @msg_id = @msgid, @message = @mess output, @msg_length = @len output, @bytes_to_skip = @skip output print @mess if (@len > 255) begin while (@skip < @len) begin xp_readmail @msg_id = @msgid, @message = @mess output, @bytes_to_skip = @skip output print @mess end end
xp_readmail reads a message from the SAP ASE message inbox.
To get the message identifier of the next message in the message inbox, use xp_findnextmsg.
By default, only a system administrator can execute xp_readmail. A system administrator can grant this permission to other users.