Friday, 20 September 2013

Bypass Microsoft Exchange AntiSpam Filtering for a Specified Receive Connector

This article describes how to prevent a Specified Microsoft Exchange Receive Connector from being subjected to the AntiSpam Filtering features within Exchange's Hub Transport settings. This can be useful for allowing devices (such as printers) on the network to relay emails through your Exchange server using an Anonymous Authenticated Connection (see my other article Configuring Outgoing Mail Server SMTP Settings for Samsung Printers using the SyncThru HTTP Interface) as this often results in Exchange detecting the relay request as possible spam.

My Environment
Microsoft Exchange Version:  Microsoft Exchange Server 2007 SP3 (SBS2008) (Version No: 8.3) (How to Get Exchange Server Version via PowerShell)

If you are having trouble configuring a network device to use your Microsoft Exchange Server to relay SMTP (email) messages, it is worth turning on the logging facility for the Receive Connector that you have set up.

Open up the Exchange Management Console, and browse to Microsoft Exchange > Server Configuration > Hub Transport. You should then see a list of your Receive connectors. Ensure you have an appropriate Receive Connector set up (see screen shots below) and temporarily set the Protocol Logging Level to Verbose on the General tab to diagnose any email test failures you encounter during network device set up.

Ensure your Network Device's IP is listed within the Remote IP address section on the Network Tab (In my example below I have a small IP address range defined as that covers my Printer IP's to [See IP Calculator]).

 Ensure you are using Basic Authentication under the Authentication Tab:-
Check the Anonymous and Exchange Users check boxes to allow anonymous and Exchange authenticated connections to relay.

The Error
After applying these settings, and testing my Samsung Printer's SMTP Settings, the printer was unable to confirm the SMTP settings were working.

Looking at the Exchange Agent log, found on the Exchange Server here:-
C:\Program Files\Microsoft\Exchange Server\TransportRoles\Logs\AgentLog\AgentLog[DATE].LOG

I came across the following entry that coincided with the time of my Printer SMTP Configuration Test:-
2013-09-11T18:18:32.154Z,08D027A356EB1EC6,,,<103620.0007@t37>,SOMEUSER@MYDOMAIN.COM,SOMEUSER@MYDOMAIN.COM;,SOMEUSER@MYDOMAIN.COM,1,Content Filter Agent,OnEndOfData,RejectMessage,550 5.7.1 Message rejected as spam by Content Filtering.,SclAtOrAboveRejectThreshold,7,DV:3.3.5705.600;SV:3.3.4604.600;SID:SenderIDStatus None;TIME:TimeBasedFeatures

The Cause
The Message Rejected as spam by Content Filtering indicates that the Exchange Server decided the message was spam.
The Fix
One method to fix this error is to allow this particular Receive Connector to by-pass Exchange's Spam Filtering. This is achieved via a PowerShell command (substitute Printers with your Receive Connector Name!):-

Get-ReceiveConnector “Printers” | Add-ADPermission -User “NT Authority\Anonymous Logon” -AccessRights ExtendedRight -ExtendedRights ms-exch-bypass-anti-spam

.After running this command, your should now be able to relay email anonymously from a network device that has an IP address specified within the Receive Connector.

External Resources

1 comment: