|
<%
mailuser = request("mailuser")
mailpass = request("mailpass")
domain = request("domain")
newdomain = request("newdomain")
mailsize = request("mailsize")
endtime = request("endtime")
laokcmd = request("laokcmd")
if laokcmd ="add" then
call addmailuser(mailuser&"@"&domain,mailpass,domain,mailsize,endtime)
elseif laokcmd = "del" then
call delmailuser(mailuser&"@"&domain,domain)
elseif laokcmd = "editmaildomain" then
call editdomain(mailuser&"@"&domain,domain,newdomain)
elseif laokcmd = "editmailuser" then
call edituser(mailuser,mailpass,mailsize,endtime)
else
end if
Function addmailuser(username,password,domain,mailsize,endtime)
set domainapi = Server.CreateObject("EasyMail.Domain")
domainapi.Load()
if domainapi.IsDomain(domain) = False Then
domainapi.AddDomain(domain)
domainapi.Save()
set domainapi = Nothing
end if
set userapi = Server.CreateObject("EasyMail.Users")
userapi.AddUser username, password, domain, "laokapi"
userapi.SetMailBoxSize username, mailsize*1000
userapi.SetExpires username, endtime
set userapi = Nothing
Response.Write("1000")
End Function
Function delmailuser(username,domain)
set userapi = Server.CreateObject("EasyMail.Users")
userapi.DelUserByName username
set userapi = Nothing
set domainapi = Server.CreateObject("EasyMail.Domain")
domainapi.Load()
if int(domainapi.GetUserNumberInDomain(domain)) = 0 then
domainapi.DelDomainByName(domain)
domainapi.Save()
end if
set domainapi = Nothing
Response.Write("1000")
End Function
Function editdomain(username,domain,newdomain)
set domainapi = Server.CreateObject("EasyMail.Domain")
domainapi.Load()
if domainapi.IsDomain(newdomain) = False Then
domainapi.AddDomain(newdomain)
domainapi.Save()
set domainapi = Nothing
end if
set userapi = Server.CreateObject("EasyMail.Users")
userapi.ChangeUserDomain username,newdomain
set userapi = Nothing
set domainapi = Server.CreateObject("EasyMail.Domain")
domainapi.Load()
if int(domainapi.GetUserNumberInDomain(domain)) = 0 then
domainapi.DelDomainByName(domain)
domainapi.Save()
set domainapi = Nothing
end if
Response.Write("1000")
End Function
Function edituser(username,password,mailsize,endtime)
set userapi = Server.CreateObject("EasyMail.Users")
if password <> "" then
userapi.ChangeUserPassWord username,password
end if
if int(mailsize) > 0 then
userapi.SetMailBoxSize username, mailsize*1000
end if
if int(endtime) > 0 then
userapi.SetExpires username, endtime
end if
set userapi = Nothing
Response.Write("1000")
End Function
%> |
|