Create Dynamic Distribution Lists Based on Email Domain
Creating and managing groups can be a hassle—especially when you have multiple domains or different teams to communicate within your organization. Without proper filters or predefined rules, manually updating group memberships can become time-consuming and prone to errors. Dynamic distribution lists in Exchange Online make group management easier by automatically adding members based on predefined rules or attributes. This means you won’t need to manually update group membership whenever someone changes roles or joins the company.
In this blog, we’ll walk you through setting up a dynamic distribution group based on a specific email domain, so your communications stay targeted and reach the right people at the right time.
Dynamic Distribution Groups (DDGs) in Exchange Online are mail-enabled groups that automatically include users based on certain criteria set by an admin. For example, you can create a group for all employees in the “Marketing” department or create a group for users with a “Manager” title. Unlike static groups, where you have to manually add or remove members, managing dynamic distribution groups is easier as they automatically update memberships based on specific criteria.
How it works:
- When someone newly joins the ‘Marketing’ department, they will be added to the group automatically.
- When someone leaves the organization or moves out of the ‘Marketing’ department, they will be automatically removed.
💡 Tip: If you need to review or audit group memberships for compliance or reporting purposes, consider exporting the dynamic distribution group members to CSV. This makes it easy to keep a record of current memberships and track any changes over time.
In organizations with multiple email domains under one Microsoft 365 or Azure AD tenant, you might want to set up distribution groups for each domain. This can be helpful for organizing announcements or team communications, especially if you have divisions with different domain names.
For example: You might want all users with the @contoso.com domain to be part of one DDG and all users with @fabrikam.com in another.
Creating a DDG in Exchange Online that filters members by email domain can be done via PowerShell. This offers more flexibility than the limited filtering options in the Exchange Admin Center.
First, connect to the Exchange Online PowerShell, then run the following cmdlet to create a dynamic distribution group that filters a specific SMTP domain.
New-DynamicDistributionGroup -Name "Your Group Name" -RecipientFilter "(RecipientTypeDetails -eq 'UserMailbox') -and (WindowsLiveID -like '@yourdomain.com')"
Replace “Your Group Name” with your preferred group name, and “@yourdomain.com” with the domain you want to use.
This command creates a dynamic distribution group based on their email addresses. It uses the WindowsLiveID property, which is usually the same as the user’s primary email (SMTP) address and User Principal Name.
Once you’ve created the group, you can verify its membership using:
Get-DynamicDistributionGroup -Identity "Your Group Name" | fl
This command will display information about your new distribution group, including the email domain.
We hope this blog has helped you with the insights required to create a DDG based on email domains in Exchange Online. Additionally, tracking inactive distribution lists helps ensure your email groups stay up-to-date and efficient. Thank you for reading! If you have any questions or need further clarification, please leave a comment below.