I am currently working on a php project that connects to imap and insert emails into MySQL. I added UI to reply to the email by which it canned them together. I am having one issue. If I send an email to someone it send all data fine, if the person reply it reinserts everything again. I would like to just insert the person reply and strip out the rest of the message. how can I do this? Any suggestions?
I tried wrapping the entire insert with < section > tag and tried to use preg_replace to
ignore all it's content but no luck.
This is what my insert looks like
$message=strip_tags($message, "<br><p><u><span><hr>");
$message=preg_replace("/(<br\ ?\/?>)+/", "<br/>", $message);
$message= preg_replace('/<section[^>]*>([\s\S]*?)<\/section[^>]*>/', '', $message);
$message=clean("<br/><hr><u>Received On $rep_date / $from_email</u><br/>$message");
mysql_query("UPDATE USER SET INFO = CONCAT('$message',INFO) WHERE ID='$id'");
The Data stored in MySQL looks like this
<section> <p>Test data</p> etc </section>
This works but just it reinserts everything. Any suggestions?