Description: This article will show you how to create a custom DNS (bounce back) message and code when someone try’s to email a user or users in a certain group. This is done by creating a custom Transport Rule.
- Create a new distribution group in Exchange
- Open Exchange Management Shell
- I have created a custom DSN when sending to a Distribution Group named Disabled-Email, the custom message is: “The user you have tried to contact no longer exists”
Please note we will be setting the message for 5.7.10 below
Custom DNSPowerShell1New-TransportRule Disabled-Email -SentToMemberOf "Disabled-Email" -RejectMessageEnhancedStatusCode "5.7.10" -RejectMessageReasonText "The user you have tried to contact no longer exists"
- Add members that you want this bounce back message to apply to
- Below is the custom bounce back we get when attempting to send a message to someone in our Disabled-Email group. We see out custom message in Diagnostic Information for Administrators
- To create the custom message you see at “The mailbox you tried to send an e-mail to is disabled and is no longer accepting message. Please contact your Systems Administrator for more information.” we will use Exchange Management shell.
- In step 3 we specified using DSN code 5.7.10, to set the message for DSN code 5.7.10 open Exchange Management Shell
- Enter in the following to edit code 5.7.10
New DSN CodePowerShell1New-SystemMessage -DsnCode 5.7.10 -Text "The mailbox you tried to send an e-mail message to is disabled and is no longer accepting messages." -Internal $False -Language En
- The -Internal $False will show this message to external users, if you put $True it will only show this message to internal users only
- Here is the code in production, since we specified using DSN code 5.7.10 above (step 3) is will display what we set as the message for DSN code 5.7.10