Ik ben nu een mail aan het verwerken die als volgt is ingedeeld:
1
type: multipart
subtype: ALTERNATIVE
encoding: 7bit
1.1
type: text
subtype: PLAIN
encoding: 7bit
1.2
type: text
subtype: HTML
encoding: 7bit
2
type: image
subtype: GIF
encoding: base64
bij 1.2 geeft php bij de encoding aan dat het 7bit is; als ik echter in de source van de email kijk zie ik dit staan:
------=_NextPart_001_005B_01C3672F.F2682060
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
De encoding is dus quoted-printable. Ik kan alleen niet ontdekken waarom php toch denkt dat het 7bit is. Dit is m'n code:
eigenlijk staat het stukje voor die subparts een loopje verder, maar die is exact hetzelfde
Doe ik iets fout, zit er misschien een bugje in php, of is de mail gewoon dusdanig slordig opgemaakt dat php het daarom niet snapt? het is vrij lastig, want nu ziet die html email er niet meer uit (het is namelijk ook echt quoted-printable)
1
type: multipart
subtype: ALTERNATIVE
encoding: 7bit
1.1
type: text
subtype: PLAIN
encoding: 7bit
1.2
type: text
subtype: HTML
encoding: 7bit
2
type: image
subtype: GIF
encoding: base64
bij 1.2 geeft php bij de encoding aan dat het 7bit is; als ik echter in de source van de email kijk zie ik dit staan:
------=_NextPart_001_005B_01C3672F.F2682060
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
De encoding is dus quoted-printable. Ik kan alleen niet ontdekken waarom php toch denkt dat het 7bit is. Dit is m'n code:
PHP:
1
2
3
4
5
6
7
8
9
10
| $encoding = array("7bit", "8bit", "binary", "base64", "quoted-printable", "other"); // [...] $structure = imap_fetchstructure($inbox, $x); $i = 1; while ($body = imap_fetchbody($inbox, $x, $i)) { $structure->parts[$i-1] = imap_bodystruct($inbox, $x, $i); // [...] echo "encoding: ".$encoding[$structure->parts[$i-1]->encoding]."<br>\n"; } |
eigenlijk staat het stukje voor die subparts een loopje verder, maar die is exact hetzelfde
Doe ik iets fout, zit er misschien een bugje in php, of is de mail gewoon dusdanig slordig opgemaakt dat php het daarom niet snapt? het is vrij lastig, want nu ziet die html email er niet meer uit (het is namelijk ook echt quoted-printable)