如何解码IMAP正文内容

时间:2019-02-15 17:42:39

标签: php dom xpath fetch imap

我想对收件箱中收到的电子邮件进行解码,所以我写道:

$message = quoted_printable_decode(imap_fetchbody($inbox, $email_number, 1));
dd($message);

                        $doc = new \DOMDocument('1.0', 'UTF-8');
                        $internalErrors = libxml_use_internal_errors(true);
                        $doc->loadHTML($message);
                        $doc->saveHTML();
                        $xpath = new \DOMXPath($doc);

但是$message的编码字符串如下:

"""
IApRdWFuZG9vIdgsdfsdfsdfsdfsdfdsgBhcnRuZXIuCkNsaWNrIGhlcmUg\r\n
aWYgdGhpcyBlbWFpbfhjfghfhfghfghfghcmx5LgpRdWFuZG9vCkxvZ2luOiBM\r\n
b25kb24gU3RlYWtob3VzZSBDby4gLSBDaGVsc2VhCiANCllvdSBoYXZlIGEgbmV3IHJlc2VydmF0\r\n
aW9uLg0KWW91IGhhdmUgYSBuZXcgY29uZmlybWVkIHJlc2VydmF0aW9uIGZyb20gUXVhbmRvbyAo\r\n
... ... ... etc.

如何解码此字符串并创建可以使用的DOM? 有想法吗?

0 个答案:

没有答案