Just say no to spam

Posted by Nicholas Mon, 29 Jan 2007 21:38:00 GMT

Today I got extremely sick of coming on to see many hundreds of emails in my inbox from spam bots. I know a few posts ago I mentioned that I would be looking out for a solution, and I did. Unfortunately I have the attention span of a 3 year old and I forgot what I was doing fairly quick.

Today I was doing my normal blog run and I stopped by the site of a friend and co worker Douglas F Shearer when I happened across this post on his blog. Toward the end of the post he makes a short mention about how he’s now using something called Akismet as a potential guard against spam.

After quickly browsing the site I stumbled upon a very useful RoR plugin for using Akismet in my application. Setting this up was extremely trivial, and only required only a few short steps.

First, I needed to install the plugin:

script/plugin install svn://rubyforge.org/var/svn/ror-akismet

and second, I added the following code to the top of my articles controller:

include Akismet
and in the comment action:
if is_spam? :comment_author => @comment.author, :comment_type => "comment", :comment_content => @comment.body, :other => request.env 
  render( :text => "Sorry! Your comment has been marked as spam by <a href=\"http://akismet.com/\">Akismet</a>", :status => 500 ) and return false
end

Now there’s nothing left to do but sit back and try it out. As I seem to be a fairly good spam target (I seem to get a few hundred every other day) I’ll post in a few weeks or so with the results from my experience using Akismet.

Spam be damned!

Comments

(leave url/email »)