For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > May 2006 > Problem with Email::MIME and Email::MIME::Attachment::Stripper









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem with Email::MIME and Email::MIME::Attachment::Stripper
ecureuil

2006-05-27, 10:01 pm

hi,

I analyze the emails which I receive with Email::MIME and
Email::MIME::Attachment::Stripper.

my $message = do { local $/; <> };
my $parser = Email::MIME->new($message);
my @parts = $parser->parts();
my $mes1 = sprintf ("There are %d parts in the message\n", $#parts +1 );

my $stripper = Email::MIME::Attachment::Stripper->new($message);
my @attachments = $stripper->attachments;
my $mes2 = sprintf ("There are %d attachments in the message\n\n",
$#attachments +1 );


For the majority of the emails, it is ok.

email with 0 attached file :
There are 1 parts in the message
There are 0 attachments in the message

email with 4 attached files :
There are 5 parts in the message
There are 4 attachments in the message


But I have a problem with this message for example :

There are 2 parts in the message
There are 0 attachments in the message

This email has a attached file...
I don't understand
------------------------------
Date: Sun, 28 May 2006 02:20:01 +0200
From: titi@toto
Reply-To: titi@toto
User-Agent: Thunderbird 1.5 (Macintosh/20051201)
MIME-Version: 1.0
To: zoro@tata.dyndns.org
Subject: test mail (Mac + thunderbird + 1 attach. au format TXT)
X-Enigmail-Version: 0.94.0.0
Content-Type: multipart/mixed;
boundary="------------060301040809060901070107"
X-Virus-Checked: Checked by ClamAV on midgar

This is a multi-part message in MIME format.
--------------060301040809060901070107
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Bonsoir,

Le nouveau test :

Joint : fingerprint au format TXT.
(seven.fpr.txt )

juste le fingerprint
(contenu du fichier : Key fingerprint = 5C69 C0B4 805F D0B7 E76D)

Eric.



--------------060301040809060901070107
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
name="seven.fpr.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="seven.fpr.txt"

Key fingerprint = 5C69 C0B4 805F D0B7 E76D




--------------060301040809060901070107--

-----------------------------------------
With the same person and a good analysis :

There are 3 parts in the message
There are 2 attachments in the message

Date: Sat, 27 May 2006 10:38:02 +0200
From: titi@toto
Reply-To: titi@toto
User-Agent: Thunderbird 1.5 (Macintosh/20051201)
MIME-Version: 1.0
To: zoro@tata.dyndns.org
Subject: test mail avec pce jointe (format TIFF et PDF)
X-Enigmail-Version: 0.94.0.0
Content-Type: multipart/mixed;
boundary="------------040503040604070300010104"
X-Virus-Checked: Checked by ClamAV on midgar

This is a multi-part message in MIME format.
--------------040503040604070300010104
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

la partie de blabla en texte brut.

Et la pièce au format TIFF
Et une autre au format PDF

A+


--------------040503040604070300010104
Content-Type: image/tiff; x-mac-type="0"; x-mac-creator="0";
name="test.tiff"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="test.tiff"

TU0AKgAAOCyAP+BP8AQWDQeEQmFQuGQ2HQ+IRGJR
OKRWLReMRmNRuOR2PR+QSGRSOSSWTSeU
.....
AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFw
cGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1
AAAAAA==
--------------040503040604070300010104
Content-Type: application/pdf; x-mac-type="0"; x-mac-creator="0";
name="TPM_400113-001_notice.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="TPM_400113-001_notice.pdf"

JVBERi0xLjINCiXi48/ TDQoyIDAgb2JqDQo8PA0KL0xlbmd0aCAxNDY3DQo
vRmlsdGVyIC9G
....
M2M2ZmU4MjBjZWM4OTdkZjBhOGU5NDI3MT5dDQo+
Pg0Kc3RhcnR4cmVmDQo0MTI2DQolJUVP
Rg0K
--------------040503040604070300010104--

-----------------------------------------

An another example : not good!

There are 3 parts in the message
There are 1 attachments in the message

-----------------------------------------
From: titi@toto
Reply-To: titi@toto
To: zoro@tata.dyndns.org
Subject: test
Date: Sun, 28 May 2006 00:15:42 +0200
User-Agent: KMail/1.9.1
MIME-Version: 1.0
Content-Type: Multipart/Mixed;
boundary="Boundary-00=_O+MeEnZ1vKXoF61"
Message-Id: <200605280015.42564.titi@toto>

--Boundary-00=_O+MeEnZ1vKXoF61
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline

bonjour écureuil Delf est mature pour son age ;)
--
C'est souvent avec une femme idiote qu'on vit en bonne intelligence.
Albert Willemetz (1887-1962)

--Boundary-00=_O+MeEnZ1vKXoF61
Content-Type: image/jpeg;
name="01-64.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="01-64.jpg"

/9j/4AAQSkZJRgABAQEASABIAAD/ 2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkM
EQ8SEhEP
.....
KKEIooooQiiiihCKKKKEIooooQiiiihCKKKKEIoo
ooQiiiihCKKKKEIooooQiiiihCKKKKEL/9k=

--Boundary-00=_O+MeEnZ1vKXoF61--

-----------------------------------------

I don't understand...

Would you have an idea?

anne


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com