Community Documentation

Access rules (email filters)

Last updated October 8, 2008. Created by amariotti on January 7, 2007.
Edited by O Govinda, Willdex. Log in to edit this page.

Have you ever wanted to deny access to all users with a certain e-mail address? Or, better yet, have you ever wanted to only allow users with @institution.edu to create accounts on your site? Below an easy solution using Drupal's access rules.

View your access rules by going to Administer -> Access Control -> Access Rules.

Click on Add Rule and add the following e-mail rules:

  • Deny %@% (which blocks all e-mail address)
  • Allow %@institution.edu (which will allow people with anyone@institution.edu)

When you're done go and check your rules by clicking on "Check Rules." (Drupal 5)

Comments

Rules fail

Drupal 6.15.

deny email %.@%.ru when tested says it's allowed. Furthermore, xxx@mail.ru was allowed.

What am I missing?

Sorry for the typo. The rule

Sorry for the typo. The rule is %@%.ru

I get the same message

Is the rule checker wrong or is the access rules function actually not working?

My interpretation.

as written in the doc you need to...

set Deny %@% (which blocks all e-mail address)

AND THEN

Allow %@institution.edu (which will allow people with anyone@institution.edu)

in simple terms you need to start from the most restrictive rule and add exceptions to that restriction

Hope this helps

Urgent project

I got the access rules working to only accept a certain domain. How can I make a custom access denied or page redirect when users are denied registration due to their email.

Drupal 7 method?

Hi,

Is there a way to do this in Drupal 7? would be very grateful for any explanation. Is there a way to do this with the rules module / how?
thanks!!

This might help

Hello I have used this method

Hello

I have used this method to permit access only for emails of specific domain, and I have created allow rules for some accounts already registered that I do not want to lock out...

But somehow the deny rule becomes global without taking care the allow rules and I have locked out some users, maybe admin will also be after my session expires.

Any Ideas?

Finally it was due to the

Finally it was due to the fact that when you make a deny rule based on email, then you should make an allow rule also for email so that to add an exception for some users. I was doing that by username allow rule which doesn't work.

Drupal 7 where it is ?

In Drupal 7, where to set access rule ?

I used to set it in Drupal 6 . when I upgrade to Drual 7, I could not find it.

http://fengshui.herb108.com Fengshui home and garden
http://www.fengshuiinter.com Learn Fengshui on line
http://www.gma108.com Feng shui Academy

deny access completely instead of just blocking

I administer a private local group website and get 50-100 spam registers every day. If I add a rule to the spam email, they just get blocked and I still have to take time to delete them. Then they just re-register again.

Is there a way to not allow a domain (like ".com.br") to even attempt to register?