Found it out you need to do the following on windows:
From the Windows Control Panel, go to Administrative Tools
Open Component Services
Expand the Component Services folder
Expand down to Computers | My Computer | DCOM Config
Right-click on hMailServer and select properties
Select the Security tab
Under “Launch and Activation Permissions”, select Customize and click on Edit
Under “Group or user names”, click Add
For IIS6: add the built-in anonymous IIS user account
For Apache: add the Apache user account
Set the Local Launch and Local Activation permissions for this user to Allow
Then Edit PHP.ini as follows
[COM]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
;com.typelib_file =
; allow Distributed-COM calls
com.allow_dcom = true
; autoregister constants of a components typlib on com_load()
com.autoregister_typelib = true
; register constants casesensitive
com.autoregister_casesensitive = false
; show warnings on duplicate constant registrations
com.autoregister_verbose = true