Add users to a group based on their email domain

:bookmark: This guide explains how to automatically add users to a Discourse group based on their email domain. It is intended for site administrators who manage Discourse groups.

:person_raising_hand: Required user level: Administrator

Discourse allows you to automatically add users to a custom group based on the email domain that they register with.

To add users to a group based on their email domain:

  1. Navigate to the group’s “Manage” → “Membership” page.

  2. In the “Automatic” section, add the desired email domain(s).

  3. Save to apply the changes. Existing users who match the email domain will also be automatically added to the group upon saving.

:information_source: This setting is only available for custom groups that you create, but it can be used to automatically grant membership in a Discourse Trust Level group by combining it with the group’s automatic Trust Level setting:

Last edited by @SaraDev 2024-07-09T20:41:17Z

Check documentPerform check on document:
7 Likes

Hi Simon i don’t seeme to be able to see this setting when setting up the automatic rules. Any idea why?

Thanks for pointing that out. It looks like that setting has been removed. Existing users are now automatically added to the group. This is probably the desired behaviour for most cases. One thing I noticed is that when saving the changes after a domain has been added to the setting, a modal window lets you know about the changes, but there is no obvious way to back out of the change:

I’ll update this topic’s first post to describe the new behaviour. The copy that we use for the “Automatic” setting also needs to be updated to make it clear that it affects all users on the site.

1 Like

A variation on this: A user has an organizational email address which means they are added to that organization’s group. But then they leave the organization and lose access to the email address, they still have access to the group.
If they remove the email address, shouldn’t they then also be removed from the group?

1 Like