Hi,
i use your library to get mail attachments files.
It worked very well for all mail parsed, but one day my customer sent me a mail that is NOT multipart. There is only one part, that is the file attached.
Your lib apparently decoded fine the file but i found error in subsequent file manipulation: the file is corrupted.
This only happens when there is only one part in the mail, no matter if client is a webmail interface or outlook.
This is a print_r of the decoded message:
[CODE]
[Headers] => Array
(
[return-path:] => <
[email protected]>
[x-original-to:] =>
[email protected]
[delivered-to:] =>
[email protected]
[received:] => Array
(
[0] => from vsmtp2.tin.it (vsmtp2.tin.it [212.216.176.222]) by speakageline.info (Postfix) with ESMTP id E17F599430B for <
[email protected]>; Wed, 18 Jul 2007 09:45:16 +0200 (CEST)
[1] => from pswm16.cp.tin.it (192.168.70.64) by vsmtp2.tin.it (7.3.122) id 467668F6002CB31B for
[email protected]; Wed, 18 Jul 2007 09:52:27 +0200
)
[message-id:] => <
[email protected]>
[date:] => Wed, 18 Jul 2007 08:52:25 +0100 (GMT+01:00)
[from:] => "
[email protected]" <
[email protected]>
[reply-to:] => "
[email protected]" <
[email protected]>
[to:] =>
[email protected]
[subject:] => da webmail a
[email protected]
[mime-version:] => 1.0
[content-type:] => APPLICATION/OCTET-STREAM; name="Parata in partenza.3gp"
[content-transfer-encoding:] => base64
[x-originating-ip:] => 88.36.92.165
[content-disposition:] => attachment; filename="Parata in partenza.3gp"; size=426158
)
[Parts] => Array
(
)
[FileName] => Parata in partenza.3gp
[FileDisposition] => attachment
[BodyFile] => /var/tmp/GF26490/1
[BodyPart] => 1
[BodyLength] => 426152
[/CODE]
Notice that the lib saved a file with size of 426152 bytes, but headers in mail show a size of 426158 bytes.
I copied/pasted the base64 encoded text in this service http://www.motobit.com/util/base64-decoder-encoder.asp and i got a file sized 426158 bytes, not corrupted.
I tried to debug into the library but is too complicated for me (i suspect that the bug is in some substring calculation for the base64_decode func parameter).
If you need the original mail file i will send you (i have 4 different mails with same problem).
Anyway, this lib is powerful as is simple to use: very good work!!!
NB: there is only one piece not decoded, the filename when is quoted-printable:
[CODE]
[FileName] => =?UTF-8?Q?Vale_c=27=C3=A8=2E3gp?=
[FileDisposition] => attachment
[BodyFile] => /var/tmp/GF29779/1
[BodyPart] => 1
[BodyLength] => 247733
[/CODE]