r/exchangeserver • u/YellowOnline • 27d ago
Question {Exchange SE} Mail flow order
I wanted to make a mail flow rule that sends a specific NDR if the recipient is a specific, non-existing email address. Something like:
If the message...
Includes these words in the recipient's address 'anvil@acme.org'
Do the following...
reject the message and include the explanation 'Boink' with the status code: '5.7.1'This works if I create a mailbox anvil@acme.org. But if I don't, the NDR is that the recipient does not exist. I expected Exchange to first evaluate my Mail Flow Rule and send an NDR, before ever coming to the point of checking for a recipient with that email address.
For testing, I also gave an existing user daffy.duck@acme.org the alias anvil@acme.org. Daffy has forwarding active to donald.duck@disney.com. Surprisingly, the message was forwarded. So Exchange seems to check the recipient, check forwarding rules, and only then the mail flow rules. This came as a surprise to me.
So I'd like to hear some insights on this and whether there's a way to create the mail rule without an actual mailbox. I hate to have a mailbox for a testing scenario like this.
1
u/Affectionate_Gur4131 27d ago
Why not let Exchange handle it the way it already does by giving an NDR stating the mail address doesn't exist?
2
u/Nezgar 25d ago
Create a distribution group with no members with your desired email address, and allow anonymous/external senders to send to it. All messages sent to it will be silently dropped, and you can add your transport rule as well if you like...
1
u/iamnoone___ 27d ago
I don't have advice except I ran into exact situation trying to sink invalid recipients. Seems to check recip and bounce before rules fire. I ended up adding alias to a dumpster mailbox.
1
u/Eggslaws 27d ago
https://learn.microsoft.com/en-us/exchange/security-and-compliance/mail-flow-rules/conditions-and-exceptions
1
u/7amitsingh7 23d ago
I'd compare the message tracking logs for both tests. Check whether the message is rejected during recipient validation or reaches the transport rule processing stage. That should give you a clearer picture of why the custom ndr works for an existing mailbox but not for a non-existent address.