Reputation: 17764
I'm creating a newsletter feature that will allow users to send emails. Since there are malicious people out there who would want to send spam, I'm wanting to be able to check and see if the message created is spam or not.
I've looked at a couple different methods like trying spam assassin but you need the full email which I won't have until later. Or you need to install some other utilities like spamd, but I'm looking for a php class that does this for me anyone know of anything? Or am i stuck having to install some command line app that does this?
Ideally something easy like this:
$spamChecker = new SpamChecker();
$message = "Free Credit report, blah blah, I am spam! Detect me if you dare!";
if($spamChecker->isSpam($message)) {
echo "You are a spammer!";
} else {
echo "you are my friend";
}
Upvotes: 3
Views: 8872
Reputation: 48387
spam assassin but you need the full email which I won't have until later
Nonsense - there's nothing to stop you using spamassassin to process arbitary data - its just that nobody would bother documenting how to do this. You don't even have to mess about with dummy headers - just pipe it through spamc and check the return code.
However you're just going to be a target for spammers unless you're very careful about establishing the credentials of your users - and that at least means checking for a valid email address - and if they have a valid email address, why would they use your service?
Upvotes: 1
Reputation: 61803
I would have the following line of protection:
Upvotes: 1
Reputation:
Quite possibly the best service for filtering spam is Akismet. Akismet is quite widely used. It is included by default with Wordpress. I personally use it for my own site if that lends any credibility to Akismet. They also have many pre-made plugins/scripts for various server-side languages.
Upvotes: 2