Description
This article describes how to set up the MPMail mail flow rules using powershell
Requirements
- A global admin account in the Microsoft 365 tenancy
The Process
- Open powershell and connect to exchange online with the following command: Connect-ExchangeOnline
- Enter global admin credentials
- Once authenticated and connected, enter the following command to create the MPMail Inbound rule:
New-TransportRule "MPMail Inbound Rule" -ExceptIfFromScope InOrganization -RejectMessageEnhancedStatusCode 5.7.1 -RejectMessageReasonText "Email bypassed MXRecords" -ExceptIfSenderIpRanges 94.100.128.0/20,185.140.204.0/22,173.45.18.0/24,83.246.65.0/24,81.20.94.0/24,52.62.114.130,52.62.125.178,35.174.145.124,15.222.110.90,52.212.19.177 -ExceptIfMessageTypeMatches Calendaring
- Enter this command to create the rule that bypasses Microsoft Spam Filtering:
New-TransportRule "Bypass Spam Filtering" -SentToScope InOrganization -SetSCL -1
- You can also create the connector but it will still need to be validated. To create it, use the following command. Note to substitute the actual domain instead of <domain> below.
New-OutboundConnector -Name "MPMail Outbound" -Comment "Send all external outbound email through MPMail SmartHost" -Enabled $true -RecipientDomains * -SmartHosts <domain>.outbound.anz.mpmailmx.com -TlsSettings EncryptionOnly -UseMXRecord $false
- To validate the connector, use the command below or do it via M365 Exchange Online admin center under Mail Flow/Connectors
Validate-OutboundConnector -Identity "MPmail Outbound" -Recipients <enter external email address>
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article