> Dan Muey wrote:
> 
> > I have a need to grab specific Mime sections of an array.
> >
> > I've looked at and tried different Mime Modules but can't 
> seem to get 
> > it to go. I thought about parsing it manually but I'm not sure if 
> > every message will be formatted exactly the same, hence the module.
> >
> > The array contains the lines of a multipart email body, not the 
> > header, just the body.
> >
> > I have the boundary line in a variable by then.
> >
> > What I need to do is grab the text/plain section into a variable or 
> > array. In the example below I just want to grab 'I am 
> monkey hear me 
> > roar'
> >
> > These aren't actually like this in the script, they are set by a 
> > function in a module but this illustrates what they contain.
> >
> > $boundary = '------=_NextPart_000_000B_01C2D9A1.22427D20';
> > @body = '
> > ------=_NextPart_000_000B_01C2D9A1.22427D20
> > Content-Type: text/plain;
> >         charset="iso-8859-1"
> > Content-Transfer-Encoding: quoted-printable
> 
> Can you count on the header lines always stating with 
> "Content-", unless the preceding line has a semicolon as a 
> line-continuation character?  If  so, then you can scan 

Not sure, probably not though since it will come from many mail clients.

> through the headers [preferably on initial input], looking 
> for the first instance where a line does not start with 
> "Content-", and is not a continuation of another line 
> starting with that string.
> 
> Also, we know from doing CGI that the header section must 
> always be followed by an empty line.  When your program 
> detects that it is reading a header, it can watch for that 
> empty line to mark the start of the content described in the 
> header.  For the end of the content of any given mime, you 
> already have the flag line to watch for.  When you read it, 
> you can discrad all empty lines between the end of content 
> and the divider.

I think that will be the way to go unless I can wrap my littl mind around MIME::Parser.
Thanks for pointing that out! There should always be an empty line after the header!! 
Seeing it that way also opes up the possibility of splitting @body at the boundary, 
putting the header and body of the text/plain version in an array and processing that 
array the same way I did the entire email!
That may save lots of time/lines and still be modular!

Thanks for pointing out that insight to me Joseph!!!! 

DMuey


> 
> HTH
> 
> Joseph
> 
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to