Block certain domains or email addresses when registering a new user

I’m looking for a solution to block certain domains or email addresses when registering a new user.

I created a table “email_not_allowed” with fields: id, email_address
For example, I have blacklist fields in it:

@hotmobilephoneoffers.com"
"
@.cl"
"
@.ru"
"
@*.su” etc …

Now I want to check in the application: app_form_add_users in Event onValidate if the user’s email is allowed to register and trigger a warning that email is not allowed.

Unfortunately I didn’t succeed, so I’m asking for help if anyone can write me a piece of code on how to check this.

Thanks.

Put the below code in After Insert even(you can add more domains in if clause or put them in an array. yahoo.com is just an example):
$domain = strtolower(substr( strrchr( {email}, “@” ), 1 ));
$errormessage=‘Email error’;
if($domain == “yahoo.com”)
{
{email} = ‘’;
sc_error_message($errormessage);
sc_error_exit();
}