Gossamer Forum
Home : General : Perl Programming :

Curses to AOL!

Quote Reply
Curses to AOL!
Ugh it may not just be limited to AOL but AOL is the only email service I've tested so far other than my own...

Anyway I'm using MIME::Parser to parse emails and when I send from outlook it works fine and MIME::Parser can find all the MIME parts (I only want text/plain), however when sending through AOL the email doesn't arrive with parts and MIME::Parser reports 0 parts.

How do I get around that?

Ugh also Net::POP3 doesn't seem to want to delete emails even when using $pop->delete( $id )....sigh.

Anyway here is the email MIME::Parser reports no parts for:

Quote:
Return-Path: <PaulWilson18@aol.com>
Delivered-To: ....
Received: (qmail 32589 invoked from network); 23 Jun 2002 08:55:41 -0000
Received: from imo-r08.mx.aol.com (152.163.225.104)
by ns2.wiredon.net with SMTP; 23 Jun 2002 08:55:41 -0000
Received: from PaulWilson18@aol.com
by imo-r08.mx.aol.com (mail_out_v32.21.) id e.de.28e955fb (16086)
for <...>; Sat, 22 Jun 2002 14:46:33 -0400 (EDT)
Received: from aol.com (mow-m30.webmail.aol.com [64.12.137.7]) by air-id10.mx.aol.com (v86_r1.13) with ESMTP id MAILINID103-0622144633; Sat, 22 Jun 2002 14:46:33 -0400
Date: Sat, 22 Jun 2002 14:46:33 -0400
From: PaulWilson18@aol.com
To: ...
Subject: Testing
Message-ID: <1AE5E558.1A4D9399.31F49FB7@aol.com>
X-Mailer: Atlas Mailer 2.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hello Paul[/code]
...and here is the one that works:

Quote:
Return-Path: <pwilson@wiredon.net>
Delivered-To: ....
Received: (qmail 760 invoked from network); 23 Jun 2002 09:16:04 -0000
Received: from public1-bagu4-4-cust150.manc.broadband.ntl.com (HELO wiredon6pgjro8) (213.106.15.150)
by ns2.wiredon.net with SMTP; 23 Jun 2002 09:16:04 -0000
Message-ID: <000a01c1d114$058ca8e0$960f6ad5@wiredon6pgjro8>
Reply-To: "Paul Wilson" <pwilson@wiredon.net>
From: "Paul Wilson" <pwilson@wiredon.net>
To: <...>
Subject: Test
Date: Thu, 21 Mar 2002 20:07:23 -0000
Organization: WiredON
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0007_01C1D114.03808530"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C1D114.03808530
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Test


Thanks,
Paul Wilson
WiredON Web Hosting
http://www.wiredon.net/

------=_NextPart_000_0007_01C1D114.03808530
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Test</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,<BR>Paul Wilson<BR>WiredON Web =
Hosting<BR><A=20
href=3D"http://www.wiredon.net/">http://www.wiredon.net/</A></FONT></DIV>=
</BODY></HTML>

------=_NextPart_000_0007_01C1D114.03808530--

Damn I hate inconsistencies..ugh.
Quote Reply
Re: [Paul] Curses to AOL! In reply to
Most likely it's because the first message is a singlepart message, and the second one is a multipart message (a message with multiple parts, one html and one text, and one wrapper). I don't know the usage of MIME::Parser, but look for something about singlepart messages (this is going to be a very common case for anything other then outlook that doesn't use html mail).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Curses to AOL! In reply to
Dash....I was making it so much harder than I needed to, but thanks for your tip...it got my brain in gear.

I was parsing the email using:

my $entity = $parser->parse_data($email);

Then trying to loop the parts with:

Code:
# Only keep the first text/plain part we find.
my $parts = $entity->parts;

if ($parts) {
for (0..$parts) {
my $subent = $entity->parts($_);
if ($subent->mime_type eq 'text/plain') {
$body = $subent->body;
last;
}
}
}

...now thats ok if it is multi-part but as it wasn't $parts was 0 so that if block never ran. Ugh all I had to do was add:

Code:
else {
$body = $entity->body;
}

Last edited by:

Paul: Jun 23, 2002, 11:08 AM