Sep
22nd

WordPress Contact Form with Spam Protection

RSSIf you like this post, then consider subscribing to my full RSS feed. Subscribe now and you will get an offer that's only available to folks that read my feed!

SpamAll of a sudden, I was getting a HUGE volume of Contact Form spam using Ryan Duff’s great WordPress Contact Form plugin.

I’ve left comments on Ryan’s site and IM and told him that I was able to fix the issue by adding a Challenge Question, but I can’t seem to get in contact with him. So… here’s Ryan’s plugin with the new and improved Spam Protection. I am using it on my site and it’s working great.

The Plugin can now be downloaded via the Project Page: WordPress Contact Form with Spam Protection Plugin Project Page

Additional Links of Interest

find web host on the internet and choose a hosting plan that fulfill the online business needs. Those ones who are already running the business web sites they need to optimize their web sites according to the search engine optimization terms and rules. It is more important for those web sites that are utilizing the ppc advertizing tricks to earn the money. All web hosting companies are offering very cheap rates and more features then before with the amazing ecommerce web hosting packages. But anyone who is in this business should also take a look on the linux hosting plans because it is more secure and safe.

RSS feed | Trackback URI

255 Comments »

Comment by Andy
2006-10-05 06:28:24
I just wanted to say a HUGE thank you for this mod. I was using Dagon Design’s contact form plugin because it offered anti-spam verification but not being very skilled in matters of CSS, couldn’t make it look how I wanted. I had used Ryan’s plugin before but had been bombarded with spammers emailing me using it. My anti-spam - Bad Behaviour and Spam Karma - caught most of it but it was still a pain.

Yours is an elegant, neat enhancement and I reckon Ryan should adopt your mod and give you co-credit for taking the plugin further in such a useful way.

So yeah. Thank you! The contact form looks just how I want it to now. x

 
Comment by Douglas Karr
2006-10-05 17:02:54
Thanks, Andy! I was inspired by Seth Godin and the book Crypto. Seth pointed out a site (long ago) that had a 2 + 2 = 4 challenge question that never changed.

When I read the book Crypto, one of the key pieces of it was how you could pass a piece of information between 2 people that solved a problem… without someone in the middle able to figure it out.

The problem with most ’spamware’ is that a computer calculates the challenge question. That’s an inherent flaw, because it will be a computer that tries to break it.

By making the challenge question a visible aspect of my page in English, I’m avoiding the computer question and solution. And… just to make sure, I allow the person to change the question and answer any time they want.

I think it’s a great model and I hope to put it on my comments next. I get a ton of spam on my comments but have not received a single piece of SPAM on my contact form.

Appreciate your kind comments!
Doug

 
Comment by Michael
2006-10-17 19:33:57
Thank you! I’m downloading it now…
 
2006-10-18 12:57:36
[...] Douglas Karr has been kind enough to provide a modified version of the WP-ContactForm plugin that I’ve been using to manage my contact form. It’s a simple change to implement, and if you get any spam through your WP-ContactForm, this will save you a lot of headache. It’s a much simpler concept than a CAPTCHA image — it verifies humanitity through a simple challenge question. By default, this is “2 + 2 =” (4). Easy enough for anyone to answer — except for bots! Recommended. Tags: Douglas Karr, contact form, spam, WP-ContactForm, CAPTCHA, challenge question, bots [...]
 
Comment by ian
2006-10-25 06:56:42
great form!
Simple to install and works with no confusing set up.
 
Comment by Joni Mueller
2006-11-01 10:18:48
Doug, you are a gentleman and a scholar! We’ve just been bombarded in the last few days with Contact Form spam and a google of the WP support forum led me straight here. I’ve installed the new plugin and it works like a charm. I’ve also hit your PayPal button in appreciation for this lifesaving plugin/modification!

This form may end up being the single driving force behind my FINALLY getting around to updating my personal blog at joniverse.com from WP 1.5.x to WP 2!

 
Comment by Douglas Karr
2006-11-01 11:08:49
Thanks Joni!
 
Comment by Stahn
2006-11-03 12:06:33
Simple solutions for big problems. Everything should be coded this way, not a damn 50 KB plugin with things you won’t ever use or strange features (AJAX for a Contact Form? What?).

Thanks.

 
2006-11-06 00:45:24
[...] I used Wordpress Contact Form Plugin Anyway, if you could not read/write code, you can use dreamweaver to do it. Here’s a simple tutorial: Simple Contact Form __________________ "This is your life and it’s ending one minute at a time" [...]
 
Comment by Dave
2006-11-10 00:55:11
Great plugin - very much needed!!!!

thanks

 
Comment by fruityoaty
2006-11-11 13:54:03
Great mod to a great plugin. Thanks.
 
Comment by ywamer
2006-12-04 01:46:08
Hey. Thanks for the plugin. You rock!

I have tried using Ryan Duff’s original WP Contact Form, but always experienced errors with my blog (granted, probably a theme conflict). And the Phrixus WP Plugin never worked either.

What did you do? Why does it work? Why?

Anyways, thanks man! A donation is on it’s way.

 
Comment by Douglas Karr
2006-12-05 13:31:33
Thanks, ywamer!
 
2006-12-11 23:51:47
[...] I have recently been receiving a lot of WP-ContactForm spam. I love this plugin which has been created by Ryan Duff, but the spam is getting on my nerves. After doing a little searching I found a very nice site from Douglas A. Karr. He modified Ryan’s plugin to have a Challenge Question. This is great and hopefully will cut down on the spam I have been receiving through ContactForm. I will have to remember to change the answer if I change my blog title! Check it out. [...]
 
Comment by Ian Luke Kane
2007-01-03 17:17:41
Brilliant. Thank you Doug. It’s truly appreciated.
 
Comment by May C
2007-01-06 22:48:45
Hello! I’ve been trying to download the plugin but it re-directs to a page that says the page isn’t found.
 
Comment by Douglas Karr
2007-01-06 22:57:07
Sorry about that May C!

The file is there now. You happened upon the site as I was moving around some domains. I also sent you a note via email that the file is there now.

Doug

 
Comment by May C
2007-01-06 23:33:07
Thanks for fixing it! I was looking for it all day, thinking that it may have something to do with my browser so I tried various browser with the same result.

At one time I couldn’t get it to work, but it seems to work now! That’s great! At first, Bad Behavior blocked me from my site. I can’t believe it! It seems quite aggressive so I’ve added my own ip address to the whitelist since I couldn’t get a hold of the developer at all (all emails are bounced back).

Hopefully I can lessen the amount of spam emails I get from the contact form. I will periodically change the challenge question to thwart those human spammers that read.

Time will tell whether this is a good deterrant. I am keeping my fingers crossed. Thanks for the great plugin!

 
Comment by Douglas Karr
2007-01-07 14:23:02
I’ve actually never had to change my challenge question… it seems that simply having one has been good enough! Good luck!
 
Comment by Linda
2007-01-07 15:12:46
Thank you thank you thank you. We had to change servers, and suddenly everything I had used for contact forms previously was shot to h. Your form works beautifully, except I needed to change the stylesheet so that the name/text area lined up in IE (it was fine in Firefox). I simply changed the .contactright to float left. I also had to change the textarea sizes to fit my blog, but that was simple. Works like a dream!
 
Comment by Douglas Karr
2007-01-07 15:31:38
You’re very welcome, Linda! I, too, have modified the actual HTML of the form for a better layout (you can see it on my contact page on this site). I actually had so many issues with cross-browser compatibility that I gave up and made a table! I know that’s supposed to be a no-no… but it looks much better.
 
Comment by Teun Verberne
2007-01-08 08:10:35
I’ve tried to use your edited version of the contactform, but I can’t make the layout work right. At least in IE, Firefox works perfectly of course. The fill in-blocks are floating around and I need them lined up. Can you give me a hint how to do it?

http://www.ans-online.nl/anstiplijn

 
Comment by Douglas Karr
2007-01-08 10:18:40
Teun,

I’ve modified the plugin and added a table layout version. I ran into the same issues that you did and I gave up on trying to make it using CSS/HTML. Sometimes tables are the best approach.

Doug

 
Comment by Linda
2007-01-08 10:33:38
Hi Teun - the following styles are from Doug’s “wp-contactform” within the wp-contact folder. I changed just two things, I think (I can’t remember what they were!) and I added a style for the submit button. Doug - I had to change the px to ems, sorry!

The styles are applied at the beginning of this same wp-contactform page, where you’ll see a few lines that contain lengths for the textareas. This is where you can add the style to the submit button. (I hope all this makes sense). I haven’t tested the following style changes across all browsers and all resolutions, but it seems fine in both Firefox and in IE. If you test it and find a quirk, please let me know:

/* Begin Contact Form CSS */
.contactform {
position: static;
overflow: hidden;
}
.contactleft {
width: 25%;
text-align: right;
clear: both;
float: left;
display: inline;
padding: .4em;
margin: .5em 0;
}
.contactright {
width: 70%;
text-align: left;
float: left;
display: inline;
padding: .4em;
margin: .5em 0;
}
.contacterror {
border: .1em solid #ff0000;
}
.contactsubmit {
text-align:center;
}
/* End Contact Form CSS */

 
Comment by Douglas Karr
2007-01-08 15:49:49
Thanks, Linda! No apology necessary, thank-you!!!
 
2007-01-13 09:56:47
Checked out here following your link at wordpress.org. It looks like I ended up with a similar approach to yours, to deter spam registration.
 
Comment by Antonio
2007-01-21 05:23:57
Só um teste, sabe?
 
2007-01-22 21:27:06
[...] WordPress Contact Form with Spam Protection Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages. [...]
 
Comment by Michelle Dear
2007-01-27 14:42:16
I have attempted to implement several contact forms, including Ryan’s.

When I use the contact form, I get overlapping text, the name, etc is higher than the box, and the user can’t enter any data in the text box.

Is there any way anyone could help? Here is what it looks like:

http://www.michelledear.com/?page_id=48

I did make sure to clean up anything that was listed per the “if you are using a previous version” information.

Any help would be greatly appreciated.

Thanks!

Michelle Dear

Comment by Douglas Karr
2007-01-27 14:45:44
Hi Michelle,

I was irritated by CSS issues as well and gave up! You’ll see a second link up there with a table-based layout. Maybe that will fix it?

 
Comment by Douglas Karr
2007-01-27 14:46:54
PS: And your site looks great in Firefox ;). IE+CSS=Argh!
Comment by Michelle Dear
2007-01-27 14:52:34
Yes!!! You are awesome. That worked! Thank you so much.

Now you can contact me! :-)

And thanks for the kudos. Feel free to browse. Let me know what you think.

Michelle Dear

 
 
 
2007-01-27 14:55:58
[...] now have a “Contact Me” link on a page on the left.  Thanks to Doug Karr and Ryan for assistance and the plugin. • • [...]
 
Comment by bigadicmania
2007-01-28 18:55:46
Güzel bişi :D
 
Comment by Dr PennyStock
2007-02-02 11:29:00
Hi Doug
I’ve just instaled and activated your great plugin, created a Contact page, but, what need i to make for the contact form appear on my contact page, need i to insert some piece of code? and if yes, where? and or how?
I’ve read the readme file searching by instructions, but, it’s nothing useful there.
Sorry but i am a newby, can you explain step by step, please.

Thank you

Dr PennyStock

Comment by Douglas Karr
2007-02-02 12:07:16
Hello Dr.,

No problem! Build yourself a new page and then add the following snippet where you would like the form to show up:

<!–contact form–>

Be sure to setup the options for the form!

Doug

 
 
Comment by Dr PennyStock
2007-02-02 12:53:03
Thank you very much, Sir, very fast response.

Cheers
Dr PennyStock

Comment by Douglas Karr
2007-02-02 13:25:51
You’re absolutely welcome! I’ve also added notes to the page so that if other folks need a hand, the instructions are there. I should have done that a long time ago, thanks!
 
 
Comment by Dj Flush
2007-02-04 05:41:44
Very nice Plugin sir :)

Thanx for making it

Comment by Douglas Karr
2007-02-04 10:23:35
Ryan Duff deserves the credit for the original plugin… but I appreciate you taking the time to thank me for the modification! You’re most welcome!
 
 
2007-02-04 19:55:39
[...] haben. Kudos außerdem an Askimet für den Kampf gegen Spam, sowie an Douglas Karr für seine Anti-Spam-Version des Kontaktformulars von Ryan Duff. Respekt auch an Flickr-User mufasa, der auf Flickr ein Tutorial [...]
 
2007-02-05 10:25:25
[...] and it will take you to the front page. I also have a contact form in place that utilizes the WordPress Contact Form with Spam Protection by Douglas A. Karr; click on ‘Contact’ to try that out. I’ll most likely get [...]
 
Comment by Gerald Hibbs
2007-02-05 11:54:20
Howdy,

I’ve tried tons of contact forms but none of them worked on Godaddy except this one!!! It totally rocks. Also, the challenge question entry on the form can handle images! Check out my website where I basically put in a captcha image in an attempt to look more professional. Truly great, thanks very much!

Comment by Joni
2007-02-06 12:02:04
Gerald, that sounds great; I have a client looking to further secure his contact form. Would you mind sharing how you did the captcha on your page while also implementing Douglas’s improved Contact plugin?
Comment by Gerald Hibbs
2007-02-06 13:47:12
Howdy Joni,

It was really easy. Create a small captcha-type picture with a few characters just to look legit. Feel free to copy mine and upload it. Then go into the wp-admin->options->contact form.

In the “What is your challenge question?” text box here is what I put:

Word verification: (img style=”float:right;” src=”http://www.yoursite.com/images/captcha.jpg” border=”0″ alt=”"Word verification: Please enter these letters into the text box to the right of the picture.” )

replace “)” with “>” of course!

Whatever the text in the image is put that into the “correct response” text box. Save by hitting “Update options” and you are done.

If there is somehow ever a spam problem then you just change the picture and the correct response. I hope that works out for you and good luck with your client.

 
 
 
2007-02-05 12:01:50
[...] Contact Form with Spam Protection This is a form mail contact form that has a challenge question to help eliminate spam. I went through a ton of these forms before I used this one. The problem is that I use Godaddy as a hosting service and that tends to play heck with these contact forms. But this one works great. The challenge question entry that you fill in with your question even handles images so I use a captcha image in an attempt to look more professional. This plugin is a lifesaver for Godaddy users. Check the website to download as there are multiple flavors. [...]
 
2007-02-05 16:08:11
[...] WP-Contactform (Fra Ryan Duff) som email-formular i din WordPress-webside, bør du opdaterer til denne version med simpel SPAM-beskyttelse, som Douglas A Karr har været så venlig at tilbyde til fri download [...]
 
Comment by cee
2007-02-05 22:11:09
Doug,
I think Wordpress is re-writing your post a bit. The code to include the contact form is similar to an HTML comment, using two ‘dashes’. The code on this site that I copied & pasted was an emdash instead! People copying and pasting will find that the emdash won’t work…
Comment by Douglas Karr
2007-02-05 22:17:41
You’re right, cee! I tried a bunch of different ways to write it so it wouldn’t get hacked up and nothing seems to be working! I’m going to edit it in the database I think!
Comment by Douglas Karr
2007-02-05 22:31:45
Thanks cee! Always wondered what that code tag was for… ignorance is bliss! ;)
 
 
 
Comment by May C
2007-02-06 16:53:38
Sorry to bother you guys again. The plugin is great and I have not had any spam going through unlike previously when I was using the PXSMail plugin.

Regarding the lining up of fields for IE, I can see that someone has provided the code for the plugin but I’m not sure exactly where I should insert them in. Could anyone help? Or, what about the tables one? How different does it look like? Will the tables format eliminate the viewability problem entirely? Thanks for any input!

Comment by Douglas Karr
2007-02-06 22:14:37
Hi May C,

You can try either of them - it really depends on your theme on how they will look. You won’t hurt anything by copying one file with the other. If you set yourself up a new page (example: Contact), you can write your page introduction and then follow it with the form code…. Example:

Feel free to drop me a line through this form:
<!-- contactform -->

That’s really all there is to it! That code will be replaced with the form when you view it.

Doug

 
 
Comment by AJ
2007-02-07 19:30:32
I recently upgraded 4 blogs to WP2.1, and now my contact forms are misbehaving.
2 display ok. 1 doesn’t display at all and one displays a repeating error about an empty haystack in formatting.php.

The contact form quick tag is not being displayed in the edit screen on any of the blogs. (And the box is ticked on all of them).

Any ideas anyone?

 
Comment by AJ
2007-02-07 20:02:24
OK.
I have determined the haystack error is an intermittant PHP problem, so no fault of the plug-in.
The one that is not displaying at all has a similar setup to one that IS working, so maybe one of the files is corrupt. (Will completely wipe out and re-install).
Still don’t know why the quick tag is not displaying. (I think 2.1 might have an updated version of TinyMCE, could that be it?)
 
Comment by Pete
2007-02-09 18:46:57
Awesome mod, thank you much!
Comment by Douglas Karr
2007-02-09 21:16:31
Thanks, Pete! Hope you enjoy the rest of the site!
 
 
Trackback by One Woman Show
2007-02-12 04:55:40
WP Contact Form - Part III…

Or maybe it is part twenty..? Anyway, this is yet another mod of Ryan Duff’s WP Contact Form and it’s actually based on Doug Karr’s mod of the plugin, which includes a challenge (antispam) question. So the real credit for this plugin …

 
2007-02-17 01:03:46
[...] Contact Form - Part III is another mod of Ryan’s WP-Contact Form and Douglas‘ mod. It now includes custom Subject [...]
 
Comment by Matt
2007-02-17 17:54:57
Hi,

Small mistake in your post. Users want to put <!–contact form–>, not <!–contactform–> to generate the form.

–Matt

Comment by Douglas Karr
2007-02-17 18:53:32
Thanks Matt! I’ve modified the post to correct the issue.
 
 
Comment by Tudor Vlad
2007-02-18 04:48:41
Thanks, excellent work!

http://www.tudorvlad.ro

 
2007-02-19 01:59:29
[...] Contact Form - Part III ist eine weitere Modifikation von Ryans Contact Form und Douglas’ Modifikation. Neu ist die Möglichkeit eines eigenen [...]
 
 
Comment by Robbert
2007-02-22 16:47:48
Great work ! Now this plugin really rocks !

Robbert from the Netherlands.

Comment by Douglas Karr
2007-02-22 20:19:45
Thanks Robbert! And thanks for plugging it on your site!
Comment by Robbert
2007-02-23 03:08:10
Hahaha actually i should be thanking you !
This morning it was the first time that i didnt have to delete a mass over formspam out of my mailbox !!
 
 
 
2007-02-22 16:54:25
[...] Here are some details from the author of the plugin.  [...]
 
2007-02-24 14:31:11
[...] some reason his site has been down for the last few days/weeks. There is an alternative available with a challenge question. But if you want I can upload the original zip file I downloaded from Ryan Duff - just let me know [...]
 
2007-02-27 16:28:21
[...] kan email-formularer også misbruges til SPAM, men benytter du Douglas A Karr’s version af wp-contact-form til WordPress er du sikret mod misbrug fra SPAM-roboter, idet at afsenderen skal [...]
 
2007-02-28 01:17:42
[...] med farer for SPAM misbrug. Dog kan email-formularer også misbruges til SPAM, men benytter du Douglas A Karr’s opdaterede version af wp-contact-form (fra Ryan Duff) til WordPress, er du sikret mod misbrug fra SPAM-roboter, idet [...]
 
Comment by bitbybit
2007-03-03 03:06:16
Just a feature request to either change handling of or add an option for the challenge response to be case insensitive. If you use a logic question and the answer is “foo” and someone inputs “Foo”, it fails :(

Other than that minor quibble, great plugin :) Appreciate it!

 
2007-03-08 21:16:50
[...] Enfim, o desenvolvedor que  deu-me essa mão é o Douglas A Karr e você pode pegar a solução dele aqui. O que ele fez foi ao pegar um plugin de form de contato e colocar uma proteção em forma de pergunta lógica com resposta. [...]
 
Comment by Geoff
2007-03-08 21:17:37
Very nice - I’d also like to see the option to rotate between a few questions at random.

Showing a slightly randomized question will go even further to hinder spammers, I expect.

And for bitbybit, just change the line in wp-contactform.php that reads if($input == $answer) {

to if(strtolower($input) == strtolower($answer)) {

Comment by Douglas Karr
2007-03-08 21:47:51
Thanks, Geoff. I think I’ll build an option for case sensitivity in the app. I also like the idea of random questions/answers; but I’ve honestly never had contact form spam since simply applying this solution. We’ll see how long that lasts!
 
 
Comment by Israel Cefrin
2007-03-08 21:22:42
Mr. Karr
Very thanks for this solution. I thought use a CAPTCHA image plugin, but this yours is very better for simplicity.

I really apreciate it and I´m using on my website.

best regards

Comment by Douglas Karr
2007-03-08 21:46:14
Thanks, so much Israel! You’re so welcome.
Comment by Israel Cefrin
2007-03-09 18:13:17
Hello again!!
I was reading the plugin presentation text on my wordpress plugin management. On there was wrote it is possible use it on comments post, is it right ?
Do you have a example , how can I integrate the plugin on comments too ?

I´m writing a post for a wordpress about portal here in Brazil and it would very usefull to many people be able to put the form on comments.

regards

Comment by Douglas Karr
2007-03-09 18:33:07
Hi Israel,

I would like to apply this same technique to comments but I haven’t built it yet… hopefully it will be soon, though!

Thanks,
Doug

(Comments wont nest below this level)
 
 
 
 
2007-03-12 00:43:39
[...] Wordpress contact form. I realized that I needed to add a contact form to my blog - this plugin is solid and makes form spam unlikely. [...]
 
2007-03-12 07:03:31
[...] neste site um plugin (Contact Form) que além de resolver de maneira muito simples meu problema, é [...]
 
2007-03-12 13:47:04
[...] challenge question and a subject line. Now, to give credit where it’s due, it was originally Doug Karr who modified Ryan’s plugin to add the challenge question, and if you don’t want to give your visitors the option of a subject line his plugin should [...]
 
2007-03-15 03:06:16
[...] pake Intouch aku ganti pake WP-ContactForm yang udah di tambahin fitur “anti spam” oleh Doug Karr . Yang unik dari plugin WP-ContactForm modifikasi ini adalah kita bisa ngasih pertanyaan yang harus [...]
 
2007-03-15 18:11:01
[...] used a great plug-in that can be found here. Not only does it allow you to add a contact e-mail form to your blog, but this particular one also [...]
 
2007-03-16 13:51:51
[...] Contact Form - Part III is another mod of Ryan’s WP-Contact Form and Douglas‘ mod. It now includes custom Subject [...]
 
Comment by Contrid
2007-03-16 17:08:24
Thank you very much for this plugin.
Strangely…I was struggling to find something worthwhile.
This one seems to be working very well.