【发布时间】:2011-11-17 04:32:17
【问题描述】:
我只有下面的代码,它作为 hMailServer 的 DCOM API 在http://www.hmailserver.com/documentation/latest/?page=com_example_account_create 提供。下面的脚本工作正常。它没有任何参考。安装 hMailServer 后,运行以下代码可以创建一个帐户。现在,我在 C# 中需要同样的东西。他们没有为我提供任何 C# 库,我用谷歌搜索了它,但没有相关结果我只有下面的代码,但根据 hMailServer API,他们说你可以将下面的脚本转换为你想要的任何语言。但是怎么做?我什至无法理解如何开始写第一行。任何人请帮助我。
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
【问题讨论】:
-
只是为了确定:这是 vbscript (asp-classic) 还是 vb.net?
-
没关系:vb.net 不再真正使用 Call,它几乎可以肯定是经典的 asp。
-
正如您在链接网站上看到的那样,它只是 vbs。没有连接到asp。
-
不幸的是vb.net仍然允许你使用Call、CreateObject和On Error Resume Next等。
-
@Stingy:但没有什么能强迫你使用它们。