Je crois avoir une idée, je suis sur le même truc: il n'y a pas de nom de fichier. Le niveau de tableau/objet n'est pas bon.
$struct = imap_fetchstructure($mail,$j);
A coups de while(list($a, $b) : each ($struct)) imbriqués les uns sans les autres, je susi arricé à déplier tout le $struct. Il apparaît qu'il y a plusieurs [encoding]
Un au premier niveau ici ligne 2, à 0, et c'est celui-là qu'on a à if ($part->encoding == "3" )
Il y a un deuxième[encoding] au 2e niveau [parts][encoding], ici à 4, et deux au 4e niveau, l'un à 0 et l'autre à 3.
Je crois que c'est cette valeur qu'il faut récupérer. Mias comment l'écrire? Idem, même niveau pour le nom du fichier, au tien la valeur est vide.
Niveau 1. [type] - 1
Niveau 1. [encoding] - 0
Niveau 1. [ifsubtype] - 1
Niveau 1. [subtype] - ALTERNATIVE
Niveau 1. [ifdescription] - 0
Niveau 1. [ifid] - 0
Niveau 1. [bytes] - 89058
Niveau 1. [ifdisposition] - 0
Niveau 1. [ifdparameters] - 0
Niveau 1. [ifparameters] - 1
Niveau 1. [parameters] - Array
- Niveau 2 [0] /-- Niveau 3 [attribute] BOUNDARY ;
-- Niveau 3 [value] Apple-Mail-4-541384857 ;
Niveau 1. [parts] - Array
- Niveau 2 [0] /-- Niveau 3 [type] 0 ;
-- Niveau 3 [encoding] 4 ;
-- Niveau 3 [ifsubtype] 1 ;
-- Niveau 3 [subtype] PLAIN ;
-- Niveau 3 [ifdescription] 0 ;
-- Niveau 3 [ifid] 0 ;
-- Niveau 3 [lines] 6 ;
-- Niveau 3 [bytes] 121 ;
-- Niveau 3 [ifdisposition] 0 ;
-- Niveau 3 [ifdparameters] 0 ;
-- Niveau 3 [ifparameters] 1 ;
-- Niveau 3 [parameters] Array ;
--- Niveau 4 [0] - Object
-----Niveau 5 [attribute] - CHARSET
-----Niveau 5 [value] - UTF-8
--- Niveau 4 [1] - Object
-----Niveau 5 [attribute] - DELSP
-----Niveau 5 [value] - yes
--- Niveau 4 [2] - Object
-----Niveau 5 [attribute] - FORMAT
-----Niveau 5 [value] - flowed
- Niveau 2 [1] /-- Niveau 3 [type] 1 ;
-- Niveau 3 [encoding] 0 ;
-- Niveau 3 [ifsubtype] 1 ;
-- Niveau 3 [subtype] RELATED ;
-- Niveau 3 [ifdescription] 0 ;
-- Niveau 3 [ifid] 0 ;
-- Niveau 3 [bytes] 88639 ;
-- Niveau 3 [ifdisposition] 0 ;
-- Niveau 3 [ifdparameters] 0 ;
-- Niveau 3 [ifparameters] 1 ;
-- Niveau 3 [parameters] Array ;
--- Niveau 4 [0] - Object
-----Niveau 5 [attribute] - TYPE
-----Niveau 5 [value] - text/html
--- Niveau 4 [1] - Object
-----Niveau 5 [attribute] - BOUNDARY
-----Niveau 5 [value] - Apple-Mail-5-541384857
-- Niveau 3 [parts] Array ;
--- Niveau 4 [0] - Object
-----Niveau 5 [type] - 0
-----Niveau 5 [encoding] - 0
-----Niveau 5 [ifsubtype] - 1
-----Niveau 5 [subtype] - HTML
-----Niveau 5 [ifdescription] - 0
-----Niveau 5 [ifid] - 0
-----Niveau 5 [bytes] - 514
-----Niveau 5 [ifdisposition] - 0
-----Niveau 5 [ifdparameters] - 0
-----Niveau 5 [ifparameters] - 1
-----Niveau 5 [parameters] - Array
--------- Niveau 6 [0] - Object
---------------Niveau 7 [attribute] - CHARSET
---------------Niveau 7 [value] - US-ASCII
--- Niveau 4 [1] - Object
-----Niveau 5 [type] - 5
-----Niveau 5 [encoding] - 3
-----Niveau 5 [ifsubtype] - 1
-----Niveau 5 [subtype] - JPEG
-----Niveau 5 [ifdescription] - 0
-----Niveau 5 [ifid] - 1
-----Niveau 5 [id] -
-----Niveau 5 [bytes] - 87738
-----Niveau 5 [ifdisposition] - 1
-----Niveau 5 [disposition] - INLINE
-----Niveau 5 [ifdparameters] - 1
-----Niveau 5 [dparameters] - Array
--------- Niveau 6 [0] - Object
---------------Niveau 7 [attribute] - FILENAME
---------------Niveau 7 [value] - auguste-1.jpg
-----Niveau 5 [ifparameters] - 1
-----Niveau 5 [parameters] - Array
--------- Niveau 6 [0] - Object
---------------Niveau 7 [attribute] - X-UNIX-MODE
---------------Niveau 7 [value] - 0644
--------- Niveau 6 [1] - Object
---------------Niveau 7 [attribute] - NAME
---------------Niveau 7 [value] - auguste-1.jpg
Code
$struct = imap_fetchstructure($mail,$j);
while (list($a, $b) = each($struct)) {
echo"Niveau 1. [$a] - $b<br>\n";
if(is_array($b)) {
while(list($l, $m) = each($b)) {
echo"- Niveau 2 [$l] /";
while(list($u, $i) = each($m)) {
echo "-- Niveau 3 [$u] $i ; <br>\n";
if(is_array($i)) {
while(list($u2, $i2) = each($i)) {
echo"--- Niveau 4 [$u2] - $i2<br>";
while(list($u3, $i3) = each($i2)) {
echo"-----Niveau 5 [$u3] - $i3<br>";
if(is_array($i3)) {
while(list($n, $p) = each($i3)) {
echo"--------- Niveau 6 [$n] - $p<br>";
while(list($aq, $bq) = each($p)) {
echo"---------------Niveau 7 [$aq] - $bq<br>";
if(is_array($bq)) {
while(list($aq2, $bq2) = each($bq)) {
echo"--------------------- Niveau 8 [$aq2] - $bq2<br>";
}
}
}
}
}
}
}
}
}
}
}
}
Message édité par Silene le 04-01-2007 à 01:20:34