Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Extracting Message body from email using POP3Client

Reply
Thread Tools

Extracting Message body from email using POP3Client

 
 
Eadmund@letterbee.com
Guest
Posts: n/a
 
      01-17-2007
Hi,

I'm using pop3Client to succeessfully extract e-mail from my mail
server, BUT depending on the format (ie plain text, richt text or HTML)
that they are sent, I end up with a body that requres "massaging" with
regular expressions to get a clean message. I am concerned that
different systems will send me mails wilh "slightly" different formats
and wont work with my tidy routines.

Question: Has anyone got any code or can recomend a module that will
extrcat a "clean message body" from the email regardless of format /
system sent from?

Ta

Eadmund

http://www.velocityreviews.com/forums/(E-Mail Removed)

 
Reply With Quote
 
 
 
 
simonhume@yahoo.com
Guest
Posts: n/a
 
      02-27-2007
On 17 Jan, 18:25, (E-Mail Removed) wrote:
> Hi,
>
> I'm using pop3Client to succeessfullyextracte-mail from my mail
> server, BUT depending on the format (ie plain text, richt text or HTML)
> that they are sent, I end up with abodythat requres "massaging" with
> regular expressions to get a clean message. I am concerned that
> different systems will send me mails wilh "slightly" different formats
> and wont work with my tidy routines.
>
> Question: Has anyone got any code or can recomend a module that will
> extrcat a "clean messagebody" from theemailregardless of format /
> system sent from?
>
> Ta
>
> Eadmund
>
> (E-Mail Removed)



Hi,

I'm in a similar position and haven't quite figured this one out, did
you manage to find something?

I too am using the Mail:OP3Client module but by this stage I've
already dumped the email into a MySQL database.

Here's what I have:

$bodystr=index($message,"quoted-printable");
$bodyend=index($message,"</body");

if($bodystr >0) #If it's -1 then it is a plain text message
{
$bodytxt=substr($message,$bodystr+1,$bodyend-$bodystr-length("------
_=_NextPart_001_01C759B8.536E5E3B--")-2);
$bodystr=index($bodytxt,"quoted-printable");
$bodytxt2=substr($bodytxt,$bodystr+length("quoted-
printable"),length($bodytxt)-$bodystr);
$pibody.=$bodytxt2;
}else{
$pibody.=$message;
}

You can probably tell from the code, I'm new to this.

I'm still getting some extra "=" in the body of an HTML email which I
haven't investigated yet.

Thanks,
Simon.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Subject without characters Just Numbers using POP3Client. Please Help eng.john84@gmail.com Perl Misc 5 04-13-2007 02:57 PM
How to print just numbers includes in Subject using POP3Client Module. eng.john84@gmail.com Perl Misc 0 04-10-2007 01:17 AM
First line in body of Mail::POP3Client eng.john84@gmail.com Perl Misc 1 03-24-2007 12:07 PM
Problems when using Mail::POP3Client module Paul Perl Misc 4 07-11-2005 03:26 AM
Mail::POP3Client Jeff Snoxell Perl Misc 3 10-09-2003 07:59 AM



Advertisments