Article ID: 184038
Article Last Modified on 10/3/2003
declare @count int
declare @status int
declare @msg_id varchar(64)
declare @subject varchar(255)
declare @message varchar(255)
declare @recipients varchar(255)
declare @cc_list varchar(255)
declare @bcc_list varchar(255)
declare @date_received varchar(255)
declare @unread varchar(255)
declare @attachments varchar(255)
declare @skip_bytes int
declare @msg_length int
declare @fDone bit
declare @fRead bit
select @fDone = 0
select @skip_bytes = 0
select @count = 0
while (1 = 1)
begin
exec @status = xp_findnextmsg @msg_id = @msg_id output
select "status after xp_findnextmsg"
select @status
if @status <> 0
begin
select @fDone = 1
print "status = 0"
break
end
if @msg_id = NULL
begin
select @fDone = 1
print "msg_id = NULL"
break
end
select @fRead = 0
exec @status = xp_readmail
@msg_id = @msg_id,
@suppress_attach = 'true',
@subject = @subject output,
@message = @message output,
@unread = @unread output,
@skip_bytes = @skip_bytes output,
@msg_length = @msg_length output
select "status after xp_readmail = ", @status
select "unread = ", @unread
if @status <> 0
begin
select @fRead = 1
select "status = 0"
break
end
select "msgid" = @msg_id, "msg part" = @message
select "skipped bytes", @skip_bytes
select "msg_length", @msg_length
select @subject
select @count = @count + 1
end
go
Additional query words: msgread AV MAPI
Keywords: kbbug kbnofix KB184038