I am trying to find the encoding of a part of an E-Mail.....
At the moment,
$struct->encoding
Gives the main encoding type
But how can I get the subpart encoding type...
At the moment I have this:
if ($struct->type == 1) /* this is multipart body message time */
{
while(list($index, $sub_structure) = each($struct->parts))
{
for($i=0; $i< count($struct->parts); $i++) {
$prefix=$i.".";
echo "<font color=white>Multipart mail for $i.$index - $sub_structure - encoding ".$struct->parts[$i]->encoding."<br></font>";
if ($struct->parts[$i]->encoding ==3) {
$arr["body"] = imap_base64(imap_fetchbody($this->stream, $this->msg_uid, ($prefix.$index), FT_UID));
if(strtolower($struct->parts[$i]->subtype) == 'html') $html = 1;
}
else if ($struct->parts[$i]->encoding ==4) {
$arr["body"] = imap_qprint(imap_fetchbody($this->stream, $this->msg_uid, ($prefix.$index), FT_UID));
if(strtolower($struct->parts[$i]->subtype) == 'html') $html = 1;
}
else {
$arr["body"] = imap_fetchbody($this->stream, $this->msg_uid, ($prefix.$index), FT_UID);
if(strtolower($struct->subtype) == 'html') $html = 1;
}
echo $number;
}
}
}
which should split it down and decode it according to whether it was Base64 or Quoted Printable, however I can seemingly only do this for each respective part of the mail,
i.e. 0, 1, 2
As each part could be made into other parts,
i.e.
0.1,0.2,1.1,1.1.2, etc
How can I get the encoding type of each of these, to ensure that the correct decoding function is used ?
Any clues ??