SOLVED

Can a Dynamic Distribution list group be created that uses a specific SMTP domain as the filter?

Copper Contributor

Our corporate Microsoft 365 Exchange environment has users with different SMTP addresses. (e.g., @ work1.com @ work2.com etc.).

 

Can a Dynamic Distribution list group be created that uses a specific SMTP domain as the filter?

 

Thank you!

~Peter

9 Replies

@pcryan5220 

 

How about using this ?

 

EmailAddresses -like 'SMTP:*domain.com'

As mailboxes can have multiple SMTP address (from different domains) assigned, its best to use something like the UPN value instead:

UserPrincipalName -like '*@domain.com'

but EmailAddresses would also work

EmailAddresses -like '*@domain.com'
Thank you Kidd_IP and Vasil Michev - exactly what I was looking / hoping for.
Much appreciated.
Wildcards can't be used as the first character in a DDL filter... At least, I have never been able to make this work.
best response confirmed by pcryan5220 (Copper Contributor)
Solution
Hm, I hate it when I've overlooked something and Tony gets to be right :D Nope, we cannot use -like due to the limitation Tony mentioned. I do however have a working domain-based DDG, with the following filter:

(Get-DynamicDistributionGroup domain).RecipientFilter
((WindowsLiveID -eq '*@michev.onmicrosoft.com')

WindowsLiveID here can be used as a replacement for UPN, and does work for the filter:

[09:34:55][O365]# Get-DynamicDistributionGroupMember domain

Name RecipientType
---- -------------
HuKu UserMailbox
michev_gmail.com#EXT# MailUser

Apologies about the confusion, should have actually checked my setup first.
The key thing here is that you're using the equals operator instead of like (-eq versus -like). AFAIK, this works for WindowsLiveID but not for any of the other filterable properties that store email addresses.

I wrote up the details of this issue because I wanted to share them with Microsoft engineering. Here's the text:

 

Creating Dynamic Distribution Lists Based on Email Addresses

 

Exchange Online recipient filters calculate the membership of dynamic distribution groups. The filters support email addresses, but they don't work. Another method is needed to create dynamic distribution lists based on user mailbox email addresses, as we describe in this article and script.

 

https://practical365.com/dynamic-distribution-lists-email-address/

@Tony Redmond It’s not often you ask a question online and get such a series of impressive thoughtful replies. Color me impressed - and appreciative.

 

Well, helping the community is something that MVPs are supposed to do. Vasil does a much better job of this than I do, but when I become interested in an issue, I do like to think about how things work and figure out if we can do better.
1 best response

Accepted Solutions
best response confirmed by pcryan5220 (Copper Contributor)
Solution
Hm, I hate it when I've overlooked something and Tony gets to be right :D Nope, we cannot use -like due to the limitation Tony mentioned. I do however have a working domain-based DDG, with the following filter:

(Get-DynamicDistributionGroup domain).RecipientFilter
((WindowsLiveID -eq '*@michev.onmicrosoft.com')

WindowsLiveID here can be used as a replacement for UPN, and does work for the filter:

[09:34:55][O365]# Get-DynamicDistributionGroupMember domain

Name RecipientType
---- -------------
HuKu UserMailbox
michev_gmail.com#EXT# MailUser

Apologies about the confusion, should have actually checked my setup first.

View solution in original post