imap_headerinfo
和imap_fetchstructure
都没有在结果中包含明显明显的Content-type
标题[显然,我希望这在imap_headerinfo
下找到]。我可以使用什么函数来获取原始标头,以便我可以解析该标头并相应地将消息正文转换为 UTF-8?
当然,在我提出问题之后,我在八分钟后就想通了。
解决方案是像这样在消息/部分组合中运行imap_fetchmime
$headers = imap_fetchmime($this->imapStream, $msgNumber, $partNumber);
这将包含每个部分的Content-type
标头(如果可用)。