A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
Hi @Rising Flight
Thank you for sharing your question in the Q&A Forum, providing details about your application's Mail.Send permission as well as the recipients you wish to restrict.
In Exchange Online, Application Access Policies or RBAC for applications are primarily designed to control which mailboxes an app can access, rather than which recipients it can send to. This means that even if the app is scoped to a single mailbox, it could still send messages to other recipients unless an additional layer of enforcement is applied.
To achieve a practical recipient restriction, a combined approach can be considered:
Restrict the Sender Mailbox (Sender Restriction)
- Use Application Access Policy or RBAC for Applications to associate the app’s Client ID only with a controlled mailbox (e.g.,
******@contoso.com). - Create a management scope for the mailbox and assign only the necessary roles (e.g.,
SendAs).
Reference: Role Based Access Control for Applications in Exchange Online | Microsoft Learn
Enforce recipient restrictions using an Exchange Online mail flow rule
- Configure a mail flow (transport) rule to allow sending only to specific recipients.
- Any message sent from the dedicated mailbox to recipients outside the approved list (
******@contoso.com,******@contoso.com,******@contoso.com,shared******@contoso.com) will be blocked. - This applies to To, Cc, and Bcc, generating a Non-Delivery Report (NDR) for unauthorized recipients.
PowerShell example:
New-TransportRule -Name "Alerts Sender Recipient Allow-List" `
-From "******@contoso.com" `
-ExceptIfRecipientAddressMatchesPatterns "******@contoso.com","******@contoso.com","******@contoso.com","shared******@contoso.com" `
-RejectMessageEnhancedStatusCode 5.7.1 `
-RejectMessageReasonText "Recipient not allowed per application policy (Error Code 5.7.1)." `
-StopRuleProcessing $true
Reference: Mail flow rules (transport rules) in Exchange Online | Microsoft Learn
I hope this guidance provides some clarity on the approach. If you proceed with the implementation and have any questions, feel free to share, and we would be happy to look at the details together.
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.