一聚教程网:一个值得你收藏的教程网站

热门教程

一段ADSI和EXCHANGE结合的示范代码

时间:2022-06-30 11:00:38 编辑:袖梨 来源:一聚教程网

在独孤九剑兄的帮助下,完成了这段代码
包括NT用户的建立,EXCHANGE邮箱的建立,两者的结合,权限的设置
本代码在nt4.0+sp6+exchange5.5+adsi2.5下运行通过
建立以后的用户可以直接收发信件,是一个简化版本的WEB MAIL ACCESS
adsi_exchange.asp
-----------------------------------------------------------------------
<%
Set sid = CreateObject("ADsSID")
Set sec = CreateObject("ADsSecurity")
Set ace = CreateObject("AccessControlEntry")
'----------------------------------------------------------------------------
'--- 如果没有安装ADSI2.5的安全库要手工定义以下参数
'-----------------------------------------------------------------------------
Const ADS_SID_HEXSTRING = 1
Const ADS_SID_WINNT_PATH = 5
Const ADS_RIGHT_EXCH_MODIFY_USER_ATT = &H2
Const ADS_RIGHT_EXCH_MAIL_SEND_AS = &H8
Const ADS_RIGHT_EXCH_MAIL_RECEIVE_AS = &H10
'-------------------------------------------------------
'-----创建邮箱步骤----------------------
'--------------------------------------------------------
'---- 基本信息
server1 = "114DOMAINSERVER"
Org = "114ONLINE"
Site = "EXCHANGE"
domain = "EXCHANGE"
userName = "liuoo"
password = "43444"
'--- 邮箱信息 -----
strDisplayName = "rtrtrt"
strFirstName = "gfgf"
strLastName = "fgfgfg"
strAlias = userName
strMTA = "cn=Microsoft MTA,cn=" & server1 & ",cn=Servers,cn=Configuration,ou=" & Site & ",o=" & Org
strMDB = "cn=Microsoft Private MDB,cn=" & server1 & ",cn=Servers,cn=Configuration,ou=" & Site & ",o=" & Org
strSMTPAddr = "[email protected]"
'------ 建立一个nt用户
Set dom = GetObject("WinNT://" & domain)
Set usr = dom.Create("user", userName)
'On Error Resume Next
usr.SetInfo

热门栏目