The idea is before i send the mail , I would like to use some code to check the content whether it use spam phrase . Here is some simple code
function isSpam($text)
{
$pattern = "/\b(actual|filter|removed|because|it|contained|obscenities)\b/i";
if(preg_match($pattern, $text, $match))
return true;
else
return false;
}
The question are:
Are there any way to improve the code such as check the occur time not only check if it is exist?
Are there any plugin or code exist already so I do not have to redo it?
Bayesian Spam Filter is all about a mail inbox ? Is it useful as an outgoing email filter?
Thank you for helping
you can check any content if it contains any spam messages with a nice to use plugin called Akismet it is free and used by most of the CMS and blogging application like wordpress etc.
check out the link http://akismet.com/
the library itself is very easy to implement, just download the library from there website and use the provided API from there documentation. and you are good to go. i have found this to be very effective for myself.
If your server is equipped with SpamAssassin, then you could use this API: http://ppadron.blog.br/2010/05/04/php-api-to-spamassassin-spamd-protocol/ ( it might be a bit outdated, but it wouldn't be an insurmountable task to bring it up the date ).
I'm quite sure that other spam-prevention tools would have similar capabilities.