ultrus Posted October 17, 2006 Share Posted October 17, 2006 Hello,How do I detect potential spam in a string of text? I installed a php support ticket system for a client. Every 15 minutes a script checks the email, adds any new messages to the database, and informs the sender and company of thr new inquiry.I want to screen the emails a bit before getting auto-replies and being added to the system. Is there anything good out there for this? I realize that I won't be able to filter out all spam, but a good knowlegebase of spammmorific content to check against would be fantastic. :) Quote Link to comment Share on other sites More sharing options...
dwees Posted October 17, 2006 Share Posted October 17, 2006 You basically want to take a look in your spam filter of your current email client, and actually look at some of those messages, and write down some of the common words that are used in the messages, that are not typically used in regular messages.Some common words to look for are 'viagra' 'cialis', etc... Then you perform a preg_match('/(bad|words|in|here|separated|by|or|operators)/', $text); and if the results are successful, then store the spam mail somewhere for 30 days (perhaps using a cron job to automatically delete it every 30 days) or so - in case there is some legitimate email which for some reason uses one of the bad words quoted.You may want to do a $test = preg_replace(" ", "", $text); first to strip all of the spaces from the $text first because spammers usually try to 'trick' the spam filter by p u t t i n g some spaces in the middle of their words. You may also want to remove all the numbers, underscores, dashes, parenthesis, etc... as well (remembering to work on a copy of the email string rather than the original), before you do any validation.Hope this is correct, and helps.Dave Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.