I have a script that checks all emails received via IMAP.
THE PROBLEM: Every time someone answers a message, a lot of information I do not want arrives: - signature - quote - among others
I tried removing it one by one using the div class that holds this data. But each e-mail server includes in a different way. Is there any general way of returning only the message that the person actually sent without the previous pieces?
Current script I'm using to remove the pieces I do not want
<?
$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;
?>