Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved [How To?] reject email addresses being used in contact form
#1
Not Solved
is it possible to reject emails that are being sent in via the contact form from specific email addresses?

example: spammy user (not registered on the forum, mind you) fills in the 'email' field with [email protected]

can I run a check on that field before the form is submitted to see if that email address is on my 'reject' list? if not, it doesn't seem like there's a way to stop guests from spamming the contact form.
Reply
#2
Not Solved
Yes, you should be able to blacklist the email or an entire domain from your hosting control panel.
What goes around comes around
Reply
#3
Not Solved
(11-12-2015, 09:15 AM)Ashley1 Wrote: Yes, you should be able to blacklist the email or an entire domain from your hosting control panel.

I don't think that'll work in this case since mybb sends out the contact form from whatever email address is specified in the admin cp, not 'from' the person who filled in their email address in the contact form.
Reply
#4
Not Solved
Have you tried or tested it? I just did and it seems to work.
What goes around comes around
Reply
#5
Not Solved
(11-12-2015, 08:50 PM)Ashley1 Wrote: Have you tried or tested it? I just did and it seems to work.

yes, although I don't use a control panel on my vps. I blocked the email address directly within my mail server software. it does block emails if it's sent directly from the user, but since the contact form is sent from whatever email address was set up in the admin cp, it bypasses all of this.
Reply
#6
Not Solved
I did actually edit the contact form.php to make it check in the banned email addresses before submit. I think that is a solution, though it should be a setting in the contact form settings and probably added to core. Not every admin would want this, though I see it is useful.
Random Fish and Sims Maniac
MY PLUGINS
Help MyBBSupport help you - remember to mark your threads as solved


Reply
#7
Not Solved
(11-14-2015, 10:55 AM)Leefish Wrote: I did actually edit the contact form.php to make it check in the banned email addresses before submit. I think that is a solution, though it should be a setting in the contact form settings and probably added to core. Not every admin would want this, though I see it is useful.

agreed, I think it should be in core. I think it'd be even better if there was a tab for contact form filtering of emails and/or IP addresses so you can block someone from sending in a contact form while not restricting them from joining the forum.
Reply
#8
Not Solved
(11-14-2015, 10:55 AM)Leefish Wrote: I did actually edit the contact form.php to make it check in the banned email addresses before submit.

Leefish could you tell me what edit you made please?
Reply
#9
Not Solved
At line 145 in contact php there is:

if(empty($mybb->input['email']))
	{
		$errors[] = $lang->contact_no_email;
	}
	else
	{
		// Validate email
		if(!validate_email_format($mybb->input['email']))
		{
			$errors[] = $lang->contact_no_email;
		}
	}

Change that to

if(empty($mybb->input['email']))
	{
		$errors[] = $lang->contact_no_email;
	}
	
	if(is_banned_email($mybb->input['email'])) 
	{
			$errors[] = $lang->contact_no_email;
	}
	else
	{
		// Validate email
		if(!validate_email_format($mybb->input['email']))
		{
			$errors[] = $lang->contact_no_email;
		}
	}
Random Fish and Sims Maniac
MY PLUGINS
Help MyBBSupport help you - remember to mark your threads as solved


Reply
#10
Not Solved
(11-15-2015, 02:08 PM)Leefish Wrote: At line 145 in contact php

Thank you. Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)