The hMailServer COM API lets you write your own scripts and applications that integrate with hMailServer. Almost all objects in hMailServer are accessible using the COM library. As an example, both hMailServer Administrator and the PHP WebAdmin is entirely based upon the COM library. Besides writing application like theese two, you can write scripts that are automatically run when certain events take place. For example, you can write a script that filters messages before they are delivered to the recipients.
The Application object is the root object in hMailServers COM model. Using this object, you can access all hMailServer objects and settings. Before accessing any of the properties and methods on the Application object, you must call Application.Authenticate with valid credentials.
The hMailServer API behaves as most other COM APIs, but there are some special behavior which relates to exception handling and permissions.
These are the basic steps to perform when you want to access the hMailServer COM API.
For a list of changes in the COM API, see the COM API Changelog
The below examples are written in VBA. To use them, copy them to a text file, save the file with the extension .vbs and then double-click on the file in the Windows Explorer to run it. Before doing this, make sure that you fully understand the purpose of the script and what effect it may have on your hMailServer installation. We strongly recommend that you run scripts in an test environment before running them on a hMailServer installation used in production.