hMailServer is one of, if not the most feature rich and stable open source mail servers which is developed exclusively for Microsoft Windows. For those with scripting talents it comes with a well documented COM API that enables you to provide functionality to your specific needs, however hMailServer also comes with a GUI based rules wizard which can be used to generate some very powerful mail handling functionality. In this guide we'll look at using the hMailServer rules wizard to create some basic rules to demonstrate the kind of flexibility hMailServer is able to offer.
Why create rules in the first place?
There are some situations when hosting an email server where you want to be able to manage email that meet certain criteria in a specific way, and ideally manage these emails in an automated fashion. Things such as moving messages that are larger than a specified size, deleting messages that have no subject or body content, or in the case of this guide sending notifications to users when they send email to particular domains. Sometime ago I discovered I was having significant issues sending email to any email address hosted by Microsoft, such as hotmail, live and msn. I even went to the extent of testing hotmail against 10 other free email hosting providers and found that hotmail were massively inconsistent in terms standards compliant operation. Because I had no control over this I needed to be able to alert my users when sending to these domains that my server could not guarantee delivery, and this is where I was able to utilise the rules wizard functionality in hMailServer.
Creating the hMailServer Rule
Each rule in hMailServer comprises of two parts called the criteria and the action. The criteria defines the search pattern(s) used to identify the email which you wish to apply your rule to, and the action defines what tasks are executed when the criteria takes place.
The first step you need to take to create your rule is to open the hMailServer administration window and select the rules item from the tree menu on the left, as shown below in figure 1.


