Parsing Email Body with 7BIT Content-Transfer-Encoding - PHP

前端 未结 3 2123
遥遥无期
遥遥无期 2020-12-18 05:24

I\'ve been implementing some PHP/IMAP-based email handling functionality lately, and have most everything working great, except for message body decoding (in some circumstan

3条回答
  •  甜味超标
    2020-12-18 06:11

    $structure = imap_fetchstructure; NOT $encoding = $structure->encoding BUT $encoding = $structure->parts[ $p ]->encoding

    I think I had the same problem, now it's solved. (7bit didn't convert to UTF-8, kept getting ASCII) I thought I had 7bit, but changing the code to "BUT" I got $encoding=4, not $encoding=0 which means that I have to imap_qprint($body) and mb_convert_encoding($body, 'UTF-8', $charset) to get what I wanted.

    Anyway check the encoding number!! ( should be 4 not zero )

提交回复
热议问题