使用imap_fetchbody获取特定的文本/纯文本消息

时间:2014-04-12 11:26:21

标签: imap

我正在尝试制作可以显示Zalora和Groupon的简报的网站

我正在使用IMAP ..这是我的代码:

$dapet = imap_search($inbox, 'ALL');
if($dapet){
    rsort($dapet);
    foreach ($dapet as $key) {
        $structure = imap_fetchstructure($inbox, $key);
        @$part = $structure->parts[$key];
        $message = imap_fetchbody($inbox, $key,1);
        $message_content = quoted_printable_decode($message);   
        echo $message_content;
    }
}

我已经确定Zalora和Groupon的新闻稿都是MULTIPART / ALTERNATIVE ..所以我用1来表示imap_fetchbody ..

这是Zalora的结果:Result from Zalora

它显示完美:)但Groupon的结果并不好:Result from Groupon

我的问题是:

如何从groupon中仅获取特定的文本/纯文本消息(仅图像),并忽略像------=_Part_70977513_2074073966.1397213506892 Content-Type: multipart/alternative; boundary.. Bla..Bla..Bla.. ???

这样的字符串

0 个答案:

没有答案