整合MDaemon进入CRM系统

<!--#include file="conn.asp" -->
<%

if session("pcbh")<>"" then

dim user,password,domain
user=session("pcbh")
password=session("pcmm")
domain="sohu.com"
set rs1=server.createobject("AdODB.RecordSet")
sql1="select DomainId from Domains where DomainName='"&domain&"'"
rs1.open sql1,conn,1,1
domainId=rs1("DomainId")



set rs=server.createobject("AdODB.RecordSet")
sql="select * from userlist where MailBox='"&user&"'"

rs.open sql,conn,1,3


'********************************************************************
'如果没有该用户的邮箱那么就创建,这里需要创建一个邮箱文件夹和一个用户帐号
'********************************************************************
if rs.eof then

  dim Road '物理路径
  Road = "C:\MDaemon\Users\"&domain

  Set fso = Server.CreateObject("Scripting.FileSystemObject")
  if Not(fso.FolderExists(Road+"\"+user)) then
     set f = fso.CreateFolder(Road+"\"+user)
  end if
  Set fso = nothing
     
  sql="insert into UserList(Mailbox,FullName,MailDir,Password,AutoDecode,IsForwarding,AllowAccess,AllowChangeViaEmail,KeepForwardedMail,HideFromEveryone,EncryptMail,ApplyQuotas,EnableMultiPop,CanModifyGAB,CalendarOnly,MaxMessageCount,MaxDiskSpace,DomainID) values('"&user&"','"&session("pcxm")&"','"&Road&"','"&password&"',0,0,1,1,1,0,0,0,0,0,0,0,0,"&domainId&")"

  conn.execute(sql)


end if

call closeconn()
rs.close
set rs=nothing
rs1.close
set rs1=nothing


'********************************************************************
'跳转到邮箱,无需登陆
'********************************************************************
response.redirect " http://192.168.0.216:3000/WorldClient.dll?View=Main&user=";&User&"&password="&Password

end if%>

你可能感兴趣的:(Daemon)