Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 xp_readmail & attachments

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-09-05 : 23:50:44
Jeff writes "Hello, I sent a message earlier today and just wanted to clarify...

The following thread describes the problem:

*************************************

Hi,
Unfortunately I did not and I also have same problem with SS2000 on SP1.
I've been asked a lot of people and newsgroups and nobody helps me. I'm sure
it is a bug.

Regards
Nikola Milic

----- Original Message -----
From: "Jeff Erickson" <jeffe@etangotechnology.com>
To: <mnikola@placeformedia.com>
Sent: Thursday, August 30, 2001 1:52 PM
Subject: RE: Problem with mail attachment


> Did you solve your problem below? I have the same, except with SQL Server
> 2000 SP1...
>
> Permissions maybe?
>
> Thanks.
>
> Jeff Erickson
>
> *****************
>
> Hi,
> I want to save attachment from email. Problem is that I got empty file,
> because xp_readmail puts empty temp file for attachment in Temp folder.
Why?
> If I change parameter @suppress_attach to false, I'm getting error
> "xp_readmail: failed with mail error 0x80004005". I still can get mail
> subject and body, but no attachment. Maybe I have problem with
permissions?
> I am using Enterprise SQL 2000 and Outlook 2000 SP1, on Windows 2000
> Advanced Server.
> Thanks in advance
> Nikola Milic
>
> -- BEGIN SQL
> -- To run this script you must have one UNREADED mail with attachment in
> mail box
>
> declare @status int
> declare @msg_id varchar(64)
> declare @current_msg varchar(64)
> declare @subject varchar(255)
> declare @message varchar(255)
> declare @attachments varchar(255)
> declare @mapifailure int
> set @mapifailure = 0
>
>
> exec @status = master..xp_findnextmsg
> @msg_id=@msg_id output
> , @unread_only='true'
>
>
> if @status <> 0
> begin
> select @mapifailure=1
> print 'mapi1'
> print @msg_id
> print @status
> end
>
> declare @counter int
> set @counter = 0
> while (@mapifailure=0) and @counter < 1
> begin
> print @counter
> select @counter = @counter + 1
>
> exec @status = master..xp_readmail @msg_id = @msg_id
> ,@peek = 'false'
> ,@suppress_attach = 'true'
> ,@attachments = @attachments output
> ,@subject = @subject output
> ,@message = @message output
>
> print @subject
> print @message
> print @attachments
>
> if @status <> 0
> begin
> select @mapifailure=1
> print 'mapi2'
> print @status
> end
>
>
> set @attachments = 'copy /Y ' + @attachments + ' C:\test.txt'
> print @attachments
> exec master..xp_cmdshell @attachments
>
> end
>
> -- END SQL
>
>
> --------------------------------------------------------------------------
--
> ----
"
   

- Advertisement -