在ASP中用EasyMailObject组件处理Exchange邮件源代码---删除邮件时调用的文件(mail_prc.asp)
1@ Language=VBScript
1
2'*************************************
3
4'这个文件是删除邮件时调用的
5'作者:awayeah
6'邮箱:[email protected]
7
8'*************************************
9
10dim cc,cc1,sep,dd
11'取得邮件总数
12msgcount = session("msgcount")
13sep=","
14
15for i=1 to msgcount
16dd="c"+cstr(i)
17msgid=cstr(Request.Form (dd))
18if msgid="" then
19cc1=cc1+msgid
20else
21cc1=cc1+msgid+sep
22end if
23next
24
25if len(cc1)=0 then
26Response.Redirect "maillist1.asp"
27end if
28cc1=left(cc1,len(cc1)-1)
29dim arr
30arr=split(cc1,",")
31Set POP3 = CreateObject("EasyMail.POP3.5")
32pop3.account=session("straccount")
33pop3.password=session("strpassword")
34POP3.MailServer = "192.9.200.89"
35POP3.LicenseKey = "awa/S19I500R1AX30C0R3100"
36
37x = POP3.Connect()
38for i=0 to ubound(arr)
39arr(i)=clng(arr(i))
40y = POP3.DownloadHeaders
41
42'删除邮件
43
44x = POP3.DeleteSingleMessage(arr(i))
45
46If x <> 0 Then
47' Response.Write "
<p align="center"><br/><br/>删除邮件发生错误( " + CStr(x) + ").请与管理员联系.<br/><br/>"
' Response.Write "<a href="maillist1.asp">返回</a></p>
1"
2POP3.Disconnect
3Response.End
4Else
5'Response.Write "Message deleted successfully."
6'Response.Write ""
7'POP3.Disconnect
8End If
9next
10POP3.Disconnect
11Response.Redirect "maillist1.asp"
1<html>
2<head>
3<meta content="Microsoft Visual Studio 6.0" name="GENERATOR"/>
4</head>
5<body>
6</body>
7</html>