RegExCatchAll Installation

Exchange 2010 LogoRegExCatchAll is a Transport Agent for Microsoft Exchange 2007 and 2010. It provides email suffix matching based on standard .NET regular expressions and can deliver email to Exchange Mailboxes or external SMTP addresses. It stores its configuration in an XML file which can be updated live without restarting any services. It also includes a “banned alias” list, so you can blacklist any of your previously used suffixes.

This document details how to install the RegExCatchAll Transport Agent and how to configure it for use. You will need to know how to write a regular expression to match the email suffix you require. You will also need to be able to restart the MSExchangeTransport service once during installation.

Installation

You will need Administrative rights on the Exchange Server to perform the installation. You will be restarting the MSExchangeTransport service during installation.

  1. Create a directory for the Transport Agent on your Transport Server (either an Edge Transport Role or an Internet Facing Hub Role).
  2. Unzip the RegExCatchAll.zip file into that directory.
  3. Edit the config.xml according to your needs. (See Configuration, below).
  4. Open the Exchange 2007 (or 2010) Management Shell and run the following command to install the agent.
    This assumes the directory with RegExCatchAll.dll is C:\MyAgents:

    Install-TransportAgent -Name "RegExCatchAll Agent" -TransportAgentFactory:RegExCatchAll.CatchAllFactory -AssemblyPath:"C:\MyAgents\RegExCatchAllAgent.dll"

  5. Now you need to alter the priority of the RegExCatchAll Agent so it is lower than that of the Recipient Filtering Agent.  Get the list of Transport Agents:
    Get-TransportAgent

  6. In this example the priority of the Recipient Filtering Agent is 7.  We can change the RegExCatchAll Agent to this priority and the Recipient Filtering Agent will get pushed out of the way:
    Set-TransportAgent "RegExCatchAll Agent" -Priority:7

  7. Now we can enable the Agent:
    Enable-TransportAgent "RegExCatchAll Agent"


    And we can see that the Agent is at the correct priority and is enabled.

  8. You must now restart the Transport Service to ensure the Transport Agent starts:
    net stop MSExchangeTransport
    net start MSExchangeTransport

  9. To complete the installation, exit PowerShell.

Your RegExCatchAll Transport Agent is now running. (Want to Uninstall?)

Configuration

The configuration file is config.xml and should be installed in the same directory as the Agent DLL. The configuration file takes the form:

<config>
<redirect pattern="^john+\.[a-z]+@domain.com$" address="john@domain.com" />
<redirect pattern="^jane+\.[a-z]+@domain.com$" address="jane.doe@gmail.com" />
<banned address="john.spam@domain.com" />
<banned address="jane.newsletter@domain.com" />
</config>

The regular expressions in the example allow for a custom catchall address of john.anything@domain.com.  This way the user can give out custom email addresses to websites and organisations they don’t trust with their real address.  If that email address is abused, it can be added to the ban list so the user won’t receive those messages. You can  create your own regular expressions, but carefully test them first!

Note: The messages will be redirected to the specified ‘address’ and it’s important that those addresses really exist. Otherwise the message will NDR, or Recipient Filtering will reject the message.

Banned addresses are processed first, so if a recipient address matches one from the ban list it will get rejected. The sender will receive a 500 SMTP code and the connection will be dropped.

The email patterns use standard .NET regular expressions and are processed in order they appear in the config.xml. If a recipient address matches more than one regular expression the email will be redirected to the first match and no further processing will take place.

Changes to the configuration file will be picked up automatically on the fly. If there is an error in the updated configuration file, the new content will be ignored and the Agent will continue to run with the old configuration.

Regular Expressions

Two common email suffixes are the period (.) and the plus (+). The regular expression for the period is:

^john+\.[a-z]+@domain.com$

and for the plus:

^john+\+[a-z]+@domain.com$

These define suffix matching for john@domain.com. If you have good examples of suffix matches that you’ve used, let me know.

Webmentions

  • writeessay

    write essay for me http://dekrtyuijg.com/

    You actually said that fantastically.