Re: Extracting Message body from email using POP3Client



On 17 Jan, 18:25, Eadm...@xxxxxxxxxxxxx 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

Eadm...@xxxxxxxxxxxxx


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::POP3Client 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.

.



Relevant Pages

  • Re: CD-RW (Was Monitor T/off)
    ... If I had Eudora installed on my Windows computer, ... How to turn off HTML in just about every email program there is: ... HTML format within the body of a message. ... the options to either send plain text or styled text or both. ...
    (Fedora)
  • Re: Outlook sp3 upgrade internet format change to rich text
    ... the sender really should use html or plain text format (since the people ... attachment for anyone not using outlook. ...
    (microsoft.public.outlook.general)
  • Re: Cant Connect Word Mail Merge to Mail Client
    ... I was using the HTML format and I don't think that was the issue. ... security dialog boxes that appear when you use plain text fomat) ... on GMAIL and it works perfectly and have set it up as default mail client. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: winmail.dat
    ... I've also seen the same, regardless of what format you send, the receiver ... This has happened with plain text, html, rich text. ...
    (microsoft.public.outlook)
  • Re: Telling Mail to never compose HTML
    ... Yet there are time when Mail.app has me compose HTML messages. ... the format in which they were sent". ... Entourage is set to use Plain Text for new messages, ...
    (comp.sys.mac.apps)