Drupal – How to block registration from a specific domain

Drupal Oct 31, 2012 2 Comments

This requirement arose when I started to see spam registrations from a ycykly.com. ycykly.com seems to be either hacked by spammers who are using domain to spam registrations or the domain owner is spamming by himself.

In Drupal it is very easy to block registration or access from a specific domain.

This is done by using Access Rule.

From Admin -> User Management -> Access Rules click on Add Rule  to add a new rule

Drupal Access Rule

Drupal Access Rule

Check Deny under Access Type

And select E-mail under Rule type

In the Mask field add the domain name. In this example I’ve added %ycykly.com which will block registration/access from ycykly.com domain.

Next time this spammer tries to register from ycykly.com domain, he will be greeted with following message

The e-mail address xyz@ycykly.com has been denied access.

Comments

2 Responses to “ Drupal – How to block registration from a specific domain ”
  1. Aaron

    Great post. I was also looking for same solution. I tried it and it worked.
    I got a question, can I add more than one domain names in the Mask field? Would it work?

    • Ajay

      To be honest, I don’t if we can do that. I also need to block many e-mail domains. I tried to separate rules in the Mask field using comma delimiter but it didn’t work.

      You will have to create new rules for each domain.

Leave a Reply to Ajay