I am trying to use the following script to create a new account that will auto-forward incoming messages to an external address:
Code: Select all
Dim obApp
Set obApp = CreateObject("hMailServer.Application")
Call obApp.Authenticate("Administrator", "MySuperSecretPasswordComesHere")
' Locate the domain we want to add the account to
Dim obDomain
Set obDomain = obApp.Domains.ItemByName("sampledomain.com")
Dim obAccount
Set obAccount = obDomain.Accounts.Add
' Set the account properties
obAccount.Address = accName & "@sampledomain.com"
obAccount.Password = accPass
obAccount.Active = True
obAccount.MaxSize = 10 'megabytes
obAccount.ForwardAddress = "this.is@my.forward.email"
obAccount.ForwardEnabled = True
obAccount.ForwardKeepOriginal = False
obAccount.Save
BUT: The auto-forwarding is not working!
I noticed that if I select that account in "hMailServer Administrator" application, And then select the "forwarding" tab, The check-boxes are in-sync with the selections I made in the script, and the address to forward-to is there...BUT (only for this account), When I try to switch away to anything else from this "forwarding" tab, The app asks if I want to save changes (I didnt make any! i only selected the "forwarding" tab of the new account to see what's there...),
And finally, if I do select "yes" for the "save changes" request, The forwarding starts to work.
So in short, It seems like the 3 last settings in the code above (concerning the forwarding) are not saved (or not activated) until I save them manually in the UI. of course this misses the whole point of scripting the process.
Any thoughts/suggestions?
Thanx in advance,
E.