Php 仅从IMAP消息获取回复

Php 仅从IMAP消息获取回复,php,imap,Php,Imap,目前我正在制作一个系统来跟踪我的电子邮件,但是我不希望显示原始邮件 有没有办法要求IMAP只返回回复?不是全部(当您按任何电子邮件客户端发送的电子邮件回复时,它会将原始电子邮件添加到底部)。还是通过PHP本身来实现?我现在有 $msg = nl2br($msg); $msgs2 = explode("<br />", $msg); //pre($msgs2); foreach($msgs2 as $msg) {

目前我正在制作一个系统来跟踪我的电子邮件,但是我不希望显示原始邮件

有没有办法要求IMAP只返回回复?不是全部(当您按任何电子邮件客户端发送的电子邮件回复时,它会将原始电子邮件添加到底部)。还是通过PHP本身来实现?我现在有

$msg = nl2br($msg);
        $msgs2 = explode("<br />", $msg);
        //pre($msgs2);

        foreach($msgs2 as $msg) {
            if(strpos($msg, '> ') === false) $message .= "<br>".$msg;
        }
        return $message;
$msg=nl2br($msg);
$msgs2=爆炸(“
,$msg”); //预付款(msgs2美元); foreach($msgs2作为$msg){ 如果(strpos($msg,“>”)==false)$message.=“
”$msg; } 返回$message;
然而,若你们看一看原始的gmail回复,它有一些东西,比如HTML版本等等

> --f46d0442889037c1fc04b6c20955 Content-Type: text/plain; charset=ISO-8859-1
> 
> fghjfghjfgh test test eteststs
> 
> On Tue, Jan 17, 2012 at 11:35 PM, mm <
> mg.com> wrote:
> 
> >
> > On 17 Jan 2012, at 05:56, mom wrote:
> >
> > > Another email hahahahqa!
> > > On 17 Jan 2012, at 05:47, mcom wrote:
> > >
> > >> Test message, higgins is very fat
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> Please do not edit below
> > >> *************************
> > >> S
> > >
> >
> >
> 
> 
> --  
> 
> --f46d0442889037c1fc04b6c20955 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
> 
> fghjfghjfgh test test eteststs<br><br><div class=3D"gmail_quote">On
> Tue, Ja= n 17, 2012 at 11:35 PM, <a
> href=3D"mailto:maom">mm</a>
> <span dir=3D"ltr">&lt;<a href=3D"mailto:mn=
> g.com">ma</a>&gt;</span> wrote:<br> <blockquote
> class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x
> #ccc solid;padding-left:1ex"><br> On 17 Jan 2012, at 05:56, <a href=3D"mailto:.com">mag.com</a>
> wrote:<br> <br> &gt; Another email hahahahqa!<br> &gt; On 17 Jan 2012,
> at 05:47, <a href=3D"mailto:.com">ma=
> na.com</a> wrote:<br> &gt;<br> &gt;&gt; Test message,
> higgins is very fat<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br>
> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt; Please do not edit below<br>
> &gt;&gt; *************************<br> &gt;&gt; S<br> &gt;<br> <br> </blockquote></div><br><br
> clear=3D"all"><div><br></div>-- <br>Regards,<div=
> >,</div><div>=A0</div><br>
> 
> --f46d0442889037c1fc04b6c20955--
--f46d0442889037c1fc04b6c20955内容类型:文本/普通;字符集=ISO-8859-1
> 
>fghjfghjfgh测试测试
> 
>2012年1月17日星期二晚上11:35,mm<
>mg.com>写道:
> 
> >
>>2012年1月17日05:56,妈妈写道:
> >
>>>另一封电子邮件哈哈哈!
>>>2012年1月17日05:47,mcom写道:
> > >
>测试信息,希金斯很胖
> > >>
> > >>
> > >>
> > >>
> > >>
>>>>请不要编辑下面的内容
> > >> *************************
>>>>S
> > >
> >
> >
> 
> 
> --  
> 
>--f46d0442889037c1fc04b6c20955内容类型:text/html;charset=ISO-8859-1内容传输编码:引用可打印
> 
>fghjfghjfgh测试测试测试
>2012年12月17日星期二晚上11:35,
>写道:
class=3D“gmail”style=3D“边距:0.8ex;左边框:1p=x >#ccc实心;左侧填充:2012年1月17日05:56, >写道:

另一封电子邮件哈哈哈<2012年1月17日, >05:47,他写道:

测试消息, >希金斯很胖 >

请不要在下面编辑
>************************
S








clear=3D“所有”>
--
问候,>,=A0
> >--f46d0442889037c1fc04b6c20955--

但那只是gmail,还有很多其他的电子邮件客户端等等,有人能帮忙吗

电子邮件中没有通用的引用标准格式——所有的电子邮件客户端,包括GMail,都有自己的方式来发现什么是“回复”。因此,IMAP无法仅获取消息中的“回复”。

没有IMAP方法,因此您只需自己对其进行筛选。然而,引用字符有时会有所不同,即使是主要的邮件客户端(如gmail和hotmail、Outlook和Thunderbird等本地程序的在线客户端)也会偶尔出错。您可以只筛选以
开头的行,但请注意,这不是100%正确的