如何使用 PHP检测/检查邮件正文是否为tnef格式(winmail.dat)?
我不想解码,只想检查。我使用imap_fetchbody
andimap_body
来获取 BODY,我需要获取 mimetype(或类似)来检查是否为“tnef 格式”,如下所示:
if (in_array($bodyMimeType, array('application/tnef', 'application/x-tnef', 'application/ms-tnef'))) {
//Decode
}
我试过了:
$structure = imap_fetchstructure($imap, $messageId, FT_UID);
echo 'sub-type:', $structure->subtype, PHP_EOL;
echo 'encoding:', $structure->encoding, PHP_EOL;