0
votes

My question as a new developer is this; In my contact form of my portfolio website, there are fields for username, subject, email, and comments. Username and comments must be filled before submitted. Email must have a valid email address. I have had zero spam for a long time until now. I have only one spam bot tracing me ten times a day with the same spam mail. I have even added a mandatory check box to validate that the user is not a bot. Is there an alternative option besides Captcha? Maybe someway to block this one user? The bots email address is invisible in my emails. I do not want to add Captcha, because it will ruin the cohesiveness to my website as well as become a pain in the butt for my users, as no one I have met enjoys tracking that annoying photo.

www.thesunkenweb.com is my website for reference.

Thanks for the help everyone! Happy codings to you all...

3

3 Answers

1
votes

If you want to block that one spam mail, then in your server-side code, just add a check to see if it matches that mail. If so, don't send the email.

0
votes

Spam prevention is a cat and mouse game. Some tricks:

1) create a field labeled "email" with text that says "do not fill in". Hide the whole thing via CSS. If anyone fills it in, ignore them. (The real email field should be called "age" or something to confuse them. Trust me, nobody cares what your HTML says.)

2) Create a simple puzzle like "what's 1+1?" and complain if they get it wrong. In theory, they could easily modify their bot. But they are unlikely to (unless they are trying to spam your site in particular).

3) Manually (or automatically) block the IP of anybody who gets it wrong (esp more than once). Likely they are form-filling spam bots.

4) Remove the HTML "action" and "submit" part of the form. Instead, make it a JavaScript button that posts the form via AJAX. Some bots will run JavaScript, but many don't. If they do run JS, just have multiple (hidden) buttons that POST to the wrong place.

5) Ban any IP addresses that use that specific email address. (see fail2ban)

When you filter out bots, don't return a 400/500 error code. Return a 200 and text with the error message. That's harder for them to parse if they got it right or wrong.

0
votes

make an array like:

$blockedEmails = array('@gmail.com','@yahoo.com');

then add an if statement on submit:

and if it email contains one of the blocked emails in the array then deny sending else accept the sending. you can use a foreach function for it but I won't suggest to put the send mail into that loop because on each email that is then not connected with one of the blockedemails it would be sent.

so like spam mail = @haha.com,@glagla.com and my mail is @boom.com then the mail will be sent 2 times so be carefull with loops ;)