如果检测/检查,如果邮件正文是tnef格式(winmail.dat)使用PHP?
我不想解码,只是想检查一下。我使用imap_fetchbody
和imap_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;
答案 0 :(得分:0)
我认为没有解码就无法知道,我正在对其进行解码,并使用exec()
,exec("tnef {$datfile} 2>&1", $output, $status)
检查其状态是否成功,如果已成功解码,则$status
将为0。