How to disallow certain email addresses or domains from submitting a form

If you're looking to prevent abusive email addresses or domains from submitting to your RSForm!Pro form, there are several effective methods you can use. Whether you want to block specific addresses across all forms or restrict submissions to a particular form, we can help you implement these measures to ensure your forms are protected from unwanted submissions.

Can you assist me in blocking abusive email addresses or domains from submitting my RSForm!Pro form?


What to do:


The Global Solution:

RSForm!Pro includes a feature called the 'List of Disposable Email Domains' which can be accessed by navigating to Extensions > RSForm!Pro > Configuration > Security tab. Here, you can specify email domain addresses you wish to block. When the 'Email Address' validation is applied to your fields, the provided email addresses will be checked against this list, and any matching domains will be rejected.

You can also use * as a wildcard to match any part of the domain, such as *.xz will reject all emails with a domain name ending in '.xz'

 

However, this setting will apply to all your RSForm!Pro forms. If you want to block specific emails or email domains on an individual form, please refer to the Individual Form Solution explained below.

 

The Individual Form Solution:
 

To restrict email addresses from submitting a particular form, you can use a script in the Scripts Called On Form Process. This script will prevent the submission if a specific or email address is detected. This is done through the $invalid variable as stated here.

For example, if your field is named 'Email', you can use something similar:

    if ($_POST['form']['Email']=='spammer@email.com')
    {
      $invalid[]=RSFormProHelper::getComponentId('Email');
    }

If someone is submitting using 'spammer@email.com', this will be rejected.

 

If you want to allow submissions only from email addresses belonging to a specific domain, you can use a similar approach:

    $fieldName = 'Email'; // change this according to your field name
    $allowedDomain = '@email.com';

    if (strpos($_POST['form'][$fieldName], $allowedDomain) === false)
    {
      $invalid[] = RSFormProHelper::getComponentId($fieldName);
    }

If someone is submitting using any other email domain but '@email.com', this will be rejected.

 


One person found this article helpful.


Was this article helpful?

Yes No
Sorry about that