I am using the imap function in PHP to check POP email boxes and display them in a web based format.
I want to accept text based email only. Basically, I really just want to reject any email messages that contain HTML format in them.
I am using preg_match() to search through the subjects of emails to delete spam emails via a spam word list.
My question is, if I use preg_match() to search for the <html> bracket, will that work or should I do a search for something else that would indicate an HTML message in the header somewhere?
Ex.
====== MY CODE =========
// $BODY is the text from the body of an email message parsed via IMAP
// $BODY = @htmlspecialchars(stripslashes(trim(imap_body($inbox, $x))));
if (preg_match ("/<html>/", "$BODY")) {
print "HTML is listed in the body";
} else {
print "HTML is not present in the body.";
}
====== END MY CODE ==========