Lets take a look at troubleshooting a Hybrid Exchange Server being used for SMTP Relay. We will ensure logging is enabled, review the relay log locations, and use the exchange management shell to find the relevant logs.
Enable logging on Exchange Connectors:
To troubleshoot effectively, we will need protocol logging enabled. We need to make sure the connectors are set to the ‘Verbose’ logging level.
- Connect to the exchange server and launch Exchange Admin Center.
- Select mail flow and go to the receive connectors tab.
- Open the receive connector and ensure Protocol logging level is set to Verbose.
- Repeat these steps for your send connectors if needed.
Enable logging on Exchange Connectors Using PowerShell:
1 |
Set-ReceiveConnector "Connection from Contoso.com" -ProtocolLoggingLevel Verbose |
Log Location:
The default location of the SMTP logs can be found here:
C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\Logs\MessageTracking
If you changed the default install location or are not using Exchange 2019, use this path:
%ExchangeInstallPath%TransportRoles\Logs\MessageTracking
View Logs Using Exchange Management Shell:
You can manually look through the txt files in the log location above, however, it is more efficient to utilize the Exchange Management Shell for this task.
- Launch the Exchange Management Shell.
- Use the Get-MessageTrackingLog command to pull your logs. Great ways to do this is by utilize the recipients, subject, or times.
- Example using date and times.
1Get-MessageTrackingLog -Server Mailbox01 -Start "09/04/2020 06:00:00" -End "09/04/2020 6:01:00" -Sender "john@contoso.com" - Example using recipients and subject.
1Get-MessageTrackingLog -Recipients "username@contoso.com" -MessageSubject "Test Subject"
Send Test Message to SMTP Relay with PowerShell:
To send a test message to the relay use the Send-MailMessage cmdlet.
1 |
Send-MailMessage -From sendername@contoso.com -to recipientname@contoso.com -SmtpServer relay.contoso.com -subject "Test Subject" |