Those are great examples. Thanks for the help.
Turns out, I have found that "preg_match" helps me do what I need to do. If there is a match (A badword in the subject of the email), then processing does not continue and the email is discarded.
====== my code =========
// Create list of bad words, separated by "|" and assign to variable.
// No preceding or trailing "|".
$BADWORD = "badword1|badword2|badword3|badword4|badword5|badword6";
// Use "preg_match" to search for any instance of badwords or
// phrase in the subject of the email (Variable $SUBJECT).
if (preg_match ("/$BADWORD/", "$SUBJECT")) {
print "$BADWORD is in the subject"; // Stop parsing email, and delete it
imap_delete ($inbox, 1);
imap_expunge ($inbox);
imap_close ($inbox);
} else {
print "$BADWORD is NOT in the subject"; // O.K. to proceed
include("inc.e.email-afteremailticket.php"); // insert email into DB
}
====== end my code =======
It feels a little clumsy, but it works very well.
Thanks again.