Perl Parsing

Perl Parsing

am 28.09.2004 20:31:01 von dan_hoffard

I am new to perl and was wondering if someone could point me in the
right direction.

What is the best way to get the body of the following email message
into a file (below)? I'd rather not bring in MIME for this small
script. The following code gets the subject and from fields
nicely by isolating "From" and "Subject", but I can't figure out how
to get the body, since there is no tag:

my ($summary, $i);

for (file_read "$f_email_html") {
if (/From\:<\/b> $i++;
$summary .= "From: $1\;\n ";
}
elsif (/Subject\:<\/b>(.+)
/) {
$i++;
$summary .= "Subject: $1\;\n ";
}

}

file_write "$f_email_summary", $summary;


Here is the .html file I am trying to parse:


(01) , href='#top'>Previous
,
Date: Sun 09/26/04 19:00:06

To: <dan_hoffard@hailmail.net>

From: Dan Hoffard

Reply to:

Subject: test

This is a multi-part message in MIME format.

------=_NextPart_000_0039_01C4A3F7.606C81F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

test
asdf1
asdf2
asdf3
asdf4
asdff
Dan Hoffard
dan_hoffard@hailmail.net

------=_NextPart_000_0039_01C4A3F7.606C81F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable





charset=3Diso-8859-1">




test

Dan Hoffard
href=3D"mailto:dan_hoffard@hailmail.net">dan_hoffard@hailmai l.net
=


------=_NextPart_000_0039_01C4A3F7.606C81F0--