E
ecureuil
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: (e-mail address removed)
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: (e-mail address removed)
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+IRGJROKRWLReMRmNRuOR2PR+QSGRSOSSWTSeU
.....
AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1
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/TDQoyIDAgb2JqDQo8PA0KL0xlbmd0aCAxNDY3DQovRmlsdGVyIC9G
....
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: (e-mail address removed)
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/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEP
.....
KKEIooooQiiiihCKKKKEIooooQiiiihCKKKKEIooooQiiiihCKKKKEIooooQiiiihCKKKKEL/9k=
--Boundary-00=_O+MeEnZ1vKXoF61--
-----------------------------------------
I don't understand...
Would you have an idea?
anne
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: (e-mail address removed)
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: (e-mail address removed)
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+IRGJROKRWLReMRmNRuOR2PR+QSGRSOSSWTSeU
.....
AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1
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/TDQoyIDAgb2JqDQo8PA0KL0xlbmd0aCAxNDY3DQovRmlsdGVyIC9G
....
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: (e-mail address removed)
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/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEP
.....
KKEIooooQiiiihCKKKKEIooooQiiiihCKKKKEIooooQiiiihCKKKKEIooooQiiiihCKKKKEL/9k=
--Boundary-00=_O+MeEnZ1vKXoF61--
-----------------------------------------
I don't understand...
Would you have an idea?
anne