我有一个脚本,用于检查通过IMAP收到的所有电子邮件。
问题: 每当有人回答一条消息时,很多我不想要的信息就会到达: -签名 -报价 -除其他外
我尝试使用保存此数据的div类将其逐个删除。 但是每个电子邮件服务器都以不同的方式包含。 有什么通用的方法可以只返回该人实际发送的消息而不发送先前的消息?
我正在使用当前脚本删除不需要的部分
<?
$ObjExtText = str_get_html([Body of the email here]);
foreach($ObjExtText->find('div[class="gmail_extraquote"]') as $DadElement1)
{
$DadElement1->outertext = "";
}
foreach($ObjExtText->find('div[class="gmail_extra"]') as $DadElement1)
{
$DadElement1->outertext = "";
}
foreach($ObjExtText->find('div[class="gmail_signature"]') as $DadElement1)
{
$DadElement1->outertext = "";
}
foreach($ObjExtText->find('div[class="gmail_quote"]') as $DadElement1)
{
$DadElement1->outertext = "";
}
foreach($ObjExtText->find('div[class="yahoo_quoted"]') as $DadElement1)
{
$DadElement1->outertext = "";
}
foreach($ObjExtText->find('div[class="yahoo_extraquote"]') as $DadElement1)
{
$DadElement1->outertext = "";
}
foreach($ObjExtText->find('div[class="yahoo_extra"]') as $DadElement1)
{
$DadElement1->outertext = "";
}
foreach($ObjExtText->find('div[class="yahoo_signature"]') as $DadElement1)
{
$DadElement1->outertext = "";
}
foreach($ObjExtText->find('div[class="yahoo_quoted"]') as $DadElement1)
{
$DadElement1->outertext = "";
}
echo $ObjExtText;
?>