Doing as you said overcame the problem of the function looking for a string! 
instead of an object!

But...

>> detach msg
starting decoding process...
== none

Then I had to change

   if boundary: find/tail boundary {boundary="}

to 

   if boundary: find/tail boundary {boundary=}

Then...

>> do %detach.r
Script: "Save email attachments to disk" (9-Jun-1999)
>> detach msg
starting decoding process...
Boundary string: Message-Boundary-1182
Found message attachment; remaining length: 6451
Found message attachment; remaining length: 6309
Found message attachment; remaining length: 5687
Found message attachment; remaining length: 5
** Script Error: copy expected range argument of type: number series
 port.
** Where: file: copy/part headers/content find body:
>>

Again, is the {boundary=} statement sent by Pegasus causing problems?

> 
> Take another look at the detach function.  It expects the wohle email
> message as text, including all the headers and everything.  If you already
> have the imported email object, you should be able to change the top of
> the detach func to look like this:
> 
> detach: func [
>     {Takes in the whole email text and returns a block of filenames
>     and decoded base64 attachments present in the email}
>     mail [object!]
> ][
>     headers: mail
>     print "Starting decoding process..."
>     boundary: headers/content-type
> 
> .. rest of script...
> 
> and then call 'detach msg'
> 
> Sterling
> 
> > I am trying to detach an attachment (.jpg image) from an e-mail using
> > the script detach.r from the REBOL script library. Unfortunately, I am
> > getting an error, as follows...
> > 
> > >> detach msg/content
> > starting decoding process...
> > ** Script Error: find expected series argument of type
> > : series port bitset.
> > ** Where: if boundary: find/tail boundary {boundary="}
> > 
> > In the 'msg/content, there is no {boundary="} statement. Instead, there
> > is a {-- Message-Boundary-11825} statement.
> > 
> > My question is: Is my Pegasus e-mail client sending some non-standard
> > "boundary" indicator? Is there any way to set this up so that the script
> > will work with most e-mail clients?
> > 
> > I can't find any other information in the REBOL docs or examples about
> > detaching e-mail attachments.
> > 
> > Thanks. Detailed msg/content and detach.r script information follows...
> > 
> > The msg/content looks as follows...
> > 
> 
> <cut out the rest>
> 


Reply via email to