----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 13, 2000 12:05 PM
Subject: [REBOL] solved (was detach-image: func (was: %detach.r ) ) Re:(8)


> Hi Allen, Ryan
>
> Allen, good catch there.  But there may also be a problem with finding the
> start of the base64.  Looking at an e-mail in my pop mailbox:
>
> ------=_NextPart_000_0025_01BFD481.83702DE0
> Content-Type: image/jpeg;
>  name="bay.jpg"
> Content-Transfer-Encoding: base64
> Content-Disposition: attachment;
>  filename="bay.jpg"
>
>
/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a
>
HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy
> ...
>
> Won't the appearance of the Content-Disposition line cause the code to
fail
> on this e-mail?
> Are the blank lines just before and after the base64 required by the MIME
> standard?
> Perhaps best to find "image/jpeg" and then find the blank line before the
> start of the base64 with "^-^-" ?
> Can we find the end of the base64 by looking for the blank line after?
> I suppose, we would like to get the image file name as well?
>
> Sorry for the stupid questions, but I don't know much about this.
>
> Cheers
>
> Larry

You are right Larry, there will also be a problem with finding the start,
after finding base64 should find "^/^/" before copying. There should be at
least one empty line between a mime content header and its content.

Something like this perhaps. (not tested).

parse/all email-contents [thru {base64^/} to "^/^/" copy text to {--}
(append
> > image-code trim copy text)]

Cheers,

Allen K




>
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, June 12, 2000 6:18 PM
> Subject: [REBOL] solved (was detach-image: func (was: %detach.r ) ) Re:(7)
>
>
> >
> > ----- Original Message -----
> > From: <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, June 13, 2000 9:13 AM
> > Subject: [REBOL] solved (was detach-image: func (was: %detach.r ) )
Re:(6)
> >
> >
> > > This now works (with .jpg images, at least)...
> >
> > The reason for that is below..
> >
> > > parse/all email-contents [thru {base64^/^/} copy text to {==} (append
> > > > > image-code text)]
> >
> >  = is only used for  padding in Base64  There is no guarantee that ==
will
> > be the terminator of base64 encoded data.
> >
> > To find the end you have to go to start of the boundary and trim the
> excess.
> >
> > parse/all email-contents [thru {base64^/^/} copy text to {--} (append
> > image-code trim copy text)]
> >
> > It will work more reliably. "--" will begin a boundary and "-" cannot
> appear
> > as a char inside base64.
> >
> >
> > Cheers,
> >
> > Allen K
> >
> >
>
>

Reply via email to