Unanswered: Using xp_readmail to read encrypted emails
I am having problems reading the body of encrypted emails in the sql mail account of Microsoft SQL Server 2000. The passwords are configured within the account so that anyone with access to the account can open them without being prompted for a password. However, when I try to access them programmatically with SQL, I cannot retrieve the body of the email. I can retrieve the subject of the email, but not the body. With unencrypted emails I can retrieve everything.
I am running a test script to return the subject of the email and the number of bytes in the body:
declare @hMessage varchar(8000)
declare @MessageText varchar(8000)
declare @MessageSubject varchar(1000)
declare @skip_bytes int
declare @msg_length int
EXEC master..xp_findnextmsg @msg_id=@hMessage OUT
WHILE @hMessage IS NOT NULL
set @skip_bytes = 0
All of the results of "0" are from encrypted emails that definitely have information in the body of the email, but SQL is not able to get to the body and returns a value of 0 for the number of bytes in the body. The unencrypted emails return the number of bytes in the body without problem.
Does anyone know what I have to do to programmatically read the body of an encrypted email with SQL?