0

如何使用 PHP检测/检查邮件正文是否为格式(winmail.dat)?

我不想解码,只想检查。我使用imap_fetchbodyandimap_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;
4

1 回答 1

0

我觉得不解码就无法知道,我正在解码它并检查状态是否成功使用exec(), exec("tnef {$datfile} 2>&1", $output, $status),如果成功解码,$status将为0。

于 2020-06-08T22:28:52.370 回答