Recently I had an issue while setting up the Microsoft Dynamics CRM Email Router, where I was connecting to an existing email mailbox and all the emails were getting pulled through to CRM dating as far back as 2008. This created a lot of irrelevant data and made things difficult for users.
Initial research suggested that setting the Message Expiration field in the Email router configuration could be the answer. "Threshold time after which a message in the mail box is considered old to be neglected in processing." Thanks to this blog explaining the Microsoft.Crm.Tools.EmailAgent.xml file.
While this did not turn out to be the case the solution did in fact turn out to be in editing this file. The MessageProcessingThresholdDays tag in this file is the key. In the configuration file this tag is initially set to -1, indicating to the Email Router that it should process all the emails it finds in the mailbox.
So the steps to fixing the issue of the CRM Email Router processing old and irrelevant email data are as follows:
NOTE: it is important to place the MessageProcessingThresholdDays tag in the ProviderOverrides as if you simply edit the existing tags the Email Router will overwrite them when is restarts.