Creating rules with HmailServer

Creating rules with HmailServer

Categories:

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.

hMailServer Rules Wizard
Figure 1

Click the add button in the right hand panel to start the hMailServer rule wizard. You should now be presented with the window shown below in figure 2. The first thing to do is to give your rule a name, which would usually be something representative of the task(s) it will be performing. The next step is to decide if the criteria should use an and or or method of pattern matching. Using the and method would mean that every single criteria would need to be met before triggering the action, where the or method would only have to match any one of the criteria to trigger the action.
Add new hMailServer rule
Figure 2

Next you need to push the add button from under the criteria section which will bring up the window as shown below in figure 3. In my case I wanted to check when email was being sent from my server to hotmail, so I selected the recipient list menu item from the predefined field drop down menu. I then set the search type drop down menu to contains, and then in the value text field I placed the string @hotmail.co as the text pattern to match against. This criteria meant that any time a user sent an email to an address that contained @hotmail.co the action for my rule would be triggered.
Add hMailServer rule criteria
Figure 3

Average rating
(0 votes)