用EasyMailObject组件处理Exchange邮件源代码(1)

在ASP中用EasyMailObject组件处理Exchange邮件源代码---读取邮件主题和大小(maillist1.asp)

1@ LANGUAGE="VBSCRIPT" 
1   
2'************************************************   
3  
4'这个文件列出所有邮件,并把邮件内容显示窗口置为空白窗口   
5'作者:awayeah   
6'邮箱:[email protected]   
7  
8'************************************************   
1<script language="vbscript">   
2parent.frmbottom.location.href="blank.htm"   
3sub cmdel_onClick()   
4'删除邮件   
5frmail.submit   
6end sub   
7</script>
1   
2if session("straccount")="" or session("strpassword")="" then   
3Response.write("

<html><title>错误,尚未登录</title><body><p align="center"><br/><br/>你尚未登录,请先退出登录!<br/><br/>")
Response.Write ("<a href="login.asp" target="_top"><img border="0" src="logout.jpg"/></a></p></body></html>

1")   
2Response.End   
3end if   
 1<html>
 2<head>
 3<title>收邮件</title>
 4</head>
 5<style>   
 6<!--   
 7A{text-decoration:none}   
 8\-->   
 9</style>
10<body bgcolor="#008080" text="#000000">   

'定义邮件服务器地址
strserver=session("strserver")
'定义帐号
strAccount=session("straccount")
'定义密码
strPassword=session("strpassword")
'设置组件的各种属性
Set POP3 = CreateObject("EasyMail.POP3.5")
POP3.LicenseKey = "awa/S19I500R1AX30C0R3100"
POP3.MailServer = strServer
POP3.Account = strAccount
POP3.Password = strPassword
pop3.PreferredBodyFormat=1
pop3.TimeOut=120

x = POP3.Connect
If x &lt;&gt; 0 Then
Response.Write "<p align="center">连接错误: " + CStr(x) + "<br/><br/>请和管理员联系"
POP3.Disconnect
Response.End
End If

x = POP3.DownloadMessages(0)
If x &lt;&gt; 0 Then
Response.Write "下载错误: " + CStr(x) +"<br/><br/>请和管理员联系"
POP3.Disconnect
Response.End
End If

1<p><br/></p>
2<form action="mail_prc.asp" method="POST" name="frmail">
3<center>
4<table bgcolor="#FFFFFF" border="1" bordercolor="#000080" cellpadding="0" cellspacing="0" width="580">
5<tr><td align="center" colspan="6">   

'分页处理
if Request.QueryString("currentpage")="" then
cp=1
else
cp=Request.QueryString("currentpage")
end if
'得到邮件总数
m_count=POP3.Messages.Count
if m_count&lt;=10 then
pagenum=1
sd=1
ed=m_count
else
pagenum=int(m_count/10)+1
if clng(cp)&lt;&gt;pagenum then
lastpage=m_count mod 10
sd=(clng(cp)-1)*10+1
ed=clng(cp)*10
else
sd=(clng(cp)-1)*10+1
ed=m_count
end if
end if

1你有<font color="ff00ff">```
2=POP3.Messages.Count
3```</font>封邮件。</td>   

session("msgcount")=POP3.Messages.Count

1</tr>
2<tr>
3<td align="center" width="20">号</td>
4<td align="center" width="120">来自/回复</td>
5<td align="center" width="270">主题</td>
6<td align="center" width="90">日期</td>
7<td align="center" width="60">大小</td>
8<td align="center" width="20">选择</td>
9</tr>   

for i= sd to ed

1  
2<tr>
3<td align="center" width="20">```
4=i
5```</td>   

fw="回复:"+replace(POP3.messages.item(i).subject,space(1),"_")

1<td width="100">   

receiver=POP3.Messages.item(i).from

if POP3.Messages.item(i).fromaddr="" then

1<a href="">   

else

1<a =fw="" =pop3.messages.item(i).fromaddr="" ```&amp;subject="```" ```','sendnew','width="600,height=480,scrollbars=yes');" href="#" onclick="javascript:window.open('sendmail1.asp?addr=```">   

end if

if trim(receiver)="" then
response.write "匿 名</a>"

else

1<a =fw="" =pop3.messages.item(i).fromaddr="" ```&amp;subject="```" ```','sendnew','width="600,height=480,scrollbars=yes');" href="#" onclick="javascript:window.open('sendmail1.asp?addr=```">
2<font face="宋体" size="2">   

=POP3.Messages.item(i).From

end if

1</a></a></td>
2<td width="270">   
3  

msgid=POP3.GetMessageID(i)

1<a href="showbody1.asp?id=```
2=msgid
3```" target="frmbottom">
4<font face="宋体" size="2">   

if trim(POP3.messages.item(i).Subject)="" then
response.write "无主题"
else
response.write POP3.messages.item(i).Subject
end if

 1</a></td>
 2<td width="90"><font face="宋体" size="2">```
 3=cdate(mid(cstr(POP3.messages.item(i).date),6,11))
 4```</font></td>
 5<td width="60"><font face="宋体" size="2">```
 6=POP3.messages.item(i).size
 7```</font></td>
 8<td><input name="c```
 9=i
10```" type="checkbox" value="```
11=i
12```"/></td>
13</tr>   

next
POP3.Disconnect

1</table>
2</center>
3<p align="center"><input name="cmdel" type="button" value="删除"/></p>
4</form>
5<div align="center">
6<table bgcolor="#FFFFFF" border="1" bordercolor="#ff0080" cellpadding="0" cellspacing="0">
7<tr><td>页数</td>   

for i=1 to pagenum

1<td><a href="maillist1.asp?currentpage=```
2=i
3```" target="frmtop"> ```
4=i
5``` </a></td>   

next

1</tr></table></div>
2</p></body>
3</html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus