How to Prepend distribution group name in subject for all distribution groups

Juan Cabrera Jamoulle 40 Reputation points
2023-03-01T16:07:10.62+00:00

Hi,

I see that I can create a rule to prepend something to a given distribution mail

https://learn.microsoft.com/en-us/exchange/security-and-compliance/mail-flow-rules/manage-mail-flow-rules#use-exchange-online-powershell-to-create-a-mail-flow-rule

But is there a way to create a rule to prepend [distribution group name] to all distribution groups of the tenant ?

Juan

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,188 questions
Exchange | Exchange Server | Management
0 comments No comments
{count} votes

Accepted answer
  1. Aholic Liang-MSFT 13,886 Reputation points Microsoft External Staff
    2023-03-03T09:45:44.2866667+00:00

    Hi @Juan Cabrera Jamoulle ,

    Yes, there is no built-in option to add different prepend subjects to the messages send to different distribution groups at once.

    As a workaround, you can refer to this script to create rules for all distribution groups in bulk:

    $DG=get-distributiongroup
    foreach ($DG1 in $DG){
    New-TransportRule -Name "Mark messages send to $DG1" -AnyOfToHeader $DG1 -PrependSubject "[ $DG1 ]"
    }
    

     

    In addition, many features of our current products are designed and upgraded based on customer feedback.

    You can submit relevant design ideas in this forum: Exchange Server · Community (microsoft.com)

    As such demand increases, the issue is likely to be released in the future.

    Thank you for your understanding and support!


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Aholic Liang-MSFT 13,886 Reputation points Microsoft External Staff
    2023-03-02T09:42:49.94+00:00

    Hi @Juan Cabrera Jamoulle ,

     

    To prepend different distribution group names for messages sent to different distribution groups, you need to set up mail flow rules for each group.

    It is recommended that you create rules in Mail Flow in the EAC.
    https://admin.exchange.microsoft.com/#/transportrules

    -


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread

    0 comments No comments

  2. Juan Cabrera Jamoulle 40 Reputation points
    2023-03-02T11:11:38.76+00:00

    Hi @Aholic Liang-MSFT

    Thank you for your answer.

    So this means that it is not possible to create a global rule to decide that the subject in all distributions groups will be prepend by [name of the group].

    I hope this option or rule will be add by Microsoft.

    0 comments No comments

  3. Juan Cabrera Jamoulle 40 Reputation points
    2023-03-03T10:58:51.9266667+00:00

    Hi @Aholic Liang-MSFT

    Thank you for your the script.

    I will submit the idea in the forum.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.