Disable M365 Direct Send

View Categories

Disable M365 Direct Send

< 1 min read

⚙️
DisableDirectSend.ps1
Get-OrganizationConfig | Select-Object Identity, RejectDirectSend

Test Direct Send
This requires a business internet circuit that does not restrict outbound SMTP on port 25. #

🦉
TestDirectSend.ps1
# Prompt for user inputs
$email = Read-Host "Enter your email address (e.g., user@yourdomain.com)"

$subject = "This is a test message using Direct Send"
$body = "Test using Powershell direct send"
$domain = Read-Host "Enter your root domain with no TLD (mycompanyemaildomain)"
$smtpServer = $domain + ".mail.protection.outlook.com"
$smtpPort = 25

# Send the email using Direct Send
Send-MailMessage -From $email -To $email -Subject $subject -Body $body -SmtpServer $smtpServer -Port $smtpPort
$smtpServer

Validate M365 Direct Send Usage #

To find emails sent via Direct Send, you can run a historical message trace in Exchange Online to pull up email delivery logs from the last 90 days. To do that,

  • Navigate to the Exchange admin center > Reports > Mail flow and select Inbound messages report from the list.
  • Next, click on the Request report and modify the Start & End date based on your requirement.
  • Click the Recipients dropdown and choose the desired recipients to receive the inbound message report.
  • Then, ensure that Received and No connector are selected under Directions and Connector type appropriately.
  • Finally, set TLS version to No TLS and hit Request to receive a report on all inbound emails received without a connector to identify Direct Send emails.
Historical message trace in Exchange Online to check Direct Send email activities