开发者

Php: Check if email content is spam

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开发者_如何学Go 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";
}


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.


I would have the following line of protection:

1. authentication.

  • First authenticate user using something like for example lightopenid. When you use google as openid provider for instance then you have a very good chance that the users isn't a spammer, because they take measures against spammers.

2. Akismet/Sblam

  • Like glenn pointed out you can use akismet which is free for personal sites. Or you could try sblam which is free to use.

3. Captcha

  • You could back the mailinglist up by captcha for even further protection.

4. authorization.

  • Ban openid urls which spam.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜