为imail和Mdaemon设计Webmail---删除邮件调用的文件(mail_prc.asp)

12/3/2006来源:IMail Server人气:7209

为imail和Mdaemon设计Webmail---删除邮件调用的文件(mail_PRc.asp)
<%@ Language=VBScript %>
<%
'*********************************

'这是删除邮件所调用的文件,按maillist1.asp中选定的邮件ID进行删除

'*********************************

'以下代码把选中的邮件ID放入数组
dim cc,cc1,sep,dd
msgcount = session("msgcount")
sep=","
for i=1 to msgcount
dd="c"+cstr(i)
msgid=cstr(Request.Form (dd))
if msgid="" then
cc1=cc1+msgid
else
cc1=cc1+msgid+sep
end if
next

if len(cc1)=0 then
Response.Redirect "maillist1.asp"
end if

cc1=left(cc1,len(cc1)-1)
'response.write cc1
dim arr
'上面把邮件ID保存成“1,2,3,4,5”的格式,再用split函数存入数组
arr=split(cc1,",")
'*********************************************

Set POP3 = CreateObject("EasyMail.POP3.5")
pop3.account=session("straccount")
pop3.passWord=session("strpassword")
POP3.MailServer = session("strserver")
POP3.LicenseKey = "awa/S19I500R1AX30C0R3100"

x = POP3.Connect()
If x <> 0 Then
Response.Write "连接错误(" + CStr(x) + ")请与管理员联系."
Response.Write "返回

"
POP3.Disconnect
Response.End
End If

for i=0 to ubound(arr) '按数组下标进行循环
arr(i)=clng(arr(i))
y = POP3.DownloadHeaders

x = POP3.DeleteSingleMessage(arr(i)) '删除邮件

If x <> 0 Then
Response.Write "



删除邮件发生错误( " + CStr(x) + ").请与管理员联系.

"
Response.Write "返回

"
POP3.Disconnect
Response.End
Else
'Response.Write "Message deleted successfully."
'Response.Write ""
'POP3.Disconnect
End If

next
pop3.disconnect
Response.Redirect "maillist1.asp"
%>