Installation and Setup


Important Note:

Throughout this tutorial, we shall refer to the hMailServer application directory as RootDir.  It will be the location to which you have installed your hMailServer application.  Yours could be at d:\apps\hmailserver, or c:\program files\hmailserver, or anywhere, really. Mine is at c:\hmailserver.


Installation and Setup Guide


In order to install the ListServer Script, you have to make sure your files are in the right place, and hMailServer is configured to use the script. Finally, you will need to configure the list config files.


Now, this looks complicated, and for sure, it really IS complicated when you start, but after awhile you begin to understand.


1.First, install hMailServer!

2.Now, make sure your Directory Structure is set up correctly.

3.Make sure that scripting is activated in hMailServerAdmin.  You will find the setting in Settings > Advanced > Settings.

     


4.Create a Distribution List in hMailServer Administrator.  There is some brief documentation on the website.  After you have created a domain, then you can add a distribution list.  To test your listserver, you should add at least two addresses to your list.



5.Prepare the Script for use

1.Find out where your EventHandler.vbs script is located by clicking on the "Show scripts" button (see image above).  This will open Windows Explorer to the correct directory.  My location is at RootDir/Events. (Remember that in this documentation, the term RootDir indicates the hMailServer application directory).  That translates to C:\hMailServer\Events\EventHandler.vbs

2.Copy the package files to the correct locations.  See Directory Structure section.

3.Initial Script Setup

1.In case you have not yet configred any vbs scripts, this means that your EvenHandler.vbs file will be empty.  In this case, you can just just replace your old EventHandler.vbs file with our new one. (If you need an empty one, there is one included in the package, called, EventHandlers_empty.vbs.

2.If you have already configured your EventHandler.vbs file,

1.Paste the global variables and settings section at the top of your script file, that is, put them above your Event Handling section so that the script will have access to the new variables.

2.Add and/or integrated the provided content of sub OnAcceptMessage and OnDeliveryStart in your OnAcceptMessage and OnDeliveryStart (just paste the provided content in your sub should do the trick)

3.Paste the subs and functions below the sub OnAcceptMessage at the end of your script (starts with the line sub check_outgoing_limitations(oClient, oMessage))

4.Advice: If you are already using automatic whitelisting, smtp outgoing limitation etc., ensure the general functions and general variables don't exist twice!

6.Adjust the global settings to suit your own configuration (This is done in EventHandler.vbs)

7.In the case that you are not using v5, activate smtp logging

8.Save the files and close the editor.

9.Check syntax of the script in hMailServer Administrator

1.If the syntax is correct, then click the "Reload scripts" button to bring the new script into hMailServer's memory.

2.If the syntax check fails, then study the error message (it will tell the you the error, and also tell you which line of the script the error exists), and make the proper corrections.  Remember that we are using option explicit, so you have to declare your variables before you use them.



10.Finally, check the event log and see if it works according to your testing (this script writes a separate logfile in the logspath).  Now, you can end up with lots of log files in the RootDir\Logs directory. Since your script exists in the EventHandlers.vbs script, it will write its log to a file named something like this: hmailserver_event_2012-09-12.log