Forum Discussion

pcryan5220's avatar
pcryan5220
Copper Contributor
Nov 21, 2023
Solved

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

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

  • Hm, I hate it when I've overlooked something and Tony gets to be right 😄 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.

13 Replies

  • Wildcards can't be used as the first character in a DDL filter... At least, I have never been able to make this work.
    • VasilMichev's avatar
      VasilMichev
      MVP
      Hm, I hate it when I've overlooked something and Tony gets to be right 😄 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.
      • TonyRedmond's avatar
        TonyRedmond
        MVP

        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/

  • 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'
    • pcryanBC's avatar
      pcryanBC
      Copper Contributor
      Thank you Kidd_IP and Vasil Michev - exactly what I was looking / hoping for.
      Much appreciated.

Resources