I just have the below code that was provides as hMailServer's DCOM API at http://www.hmailserver.com/documentation/latest/?page=com_example_account_create The below script works fine. It has no reference nothing. Just after installing hMailServer, running the below code can create an account. Now, I need the same thing in C#. They didn't provide me with any library for C# I googled for it but no relevant results all I have is the below code but in according to hMailServer API they said you can convert the below script to any language that you want. But how? I can't even understand how to start to write even the first line. Anybody please help me.
Dim obApp
Set obApp = CreateObject("hMailServer.Application")
' Authenticate. Without doing this, we won't have permission
' to change any server settings or add any objects to the
' installation.
Call obApp.Authenticate("Administrator", "your-main-hmailserver-password")
' Locate the domain we want to add the account to
Dim obDomain
Set obDomain = obApp.Domains.ItemByName("example.com")
Dim obAccount
Set obAccount = obDomain.Accounts.Add
' Set the account properties
obAccount.Address = "account@example.com"
obAccount.Password = "secret"
obAccount.Active = True
obAccount.MaxSize = 100 ' Allow max 100 megabytes
obAccount.Save
Add the COM object (hMailServer) to your C# project as a reference and translate the rest of the code to C#.
It will look something like this:
I hope this is still relevant and can help someone. Here I simply used the get item by name property to pull the domain name configured in the hMailServer.