欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-08-10 21:27:20
读取邮件主题和大小(maillist1.)<%@ language="vbscript" %><%*****************************************...
读取邮件主题和大小(maillist1.)
<%@ language="vbscript" %>
<%
************************************************

这个文件列出所有邮件,并把邮件内容显示窗口置为空白窗口
作者:awayeah
邮箱:awayeah@163.net

************************************************
%>
<script language=vbscript>
parent.frmbottom.location.href="blank.htm"
sub cmdel_onclick()
删除邮件
frmail.submit
end sub
</script>
<%
if session("straccount")="" or session("strpassword")="" then
response.write("<html><title>错误,尚未登录</title><body><p align=center><br><br>你尚未登录,请先退出登录!<br><br>")
response.write ("<a href=login.asp target=_top><img src=logout.jpg border=0></a></p></body></html>")
response.end
end if
%>
<html>
<head>
<title>收邮件</title>
</head>
<style>
<!--
a{text-decoration:none}
-->
</style>
<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 <> 0 then
response.write "<p align=center>连接错误: " + cstr(x) + "<br><br>请和管理员联系"
pop3.disconnect
response.end
end if

x = pop3.downloadmessages(0)
if x <> 0 then
response.write "下载错误: " + cstr(x) +"<br><br>请和管理员联系"
pop3.disconnect
response.end
end if%>
<p><br></p>
<form name="frmail" action="mail_prc.asp" method="post">
<center>
<table border="1" width="580" cellspacing="0" cellpadding="0" bordercolor="#000080" bgcolor="#ffffff">
<tr><td colspan=6 align="center">
<%
分页处理
if request.querystring("currentpage")="" then
cp=1
else
cp=request.querystring("currentpage")
end if
得到邮件总数
m_count=pop3.messages.count
if m_count<=10 then
pagenum=1
sd=1
ed=m_count
else
pagenum=int(m_count/10)+1
if clng(cp)<>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
%>
你有<font color="ff00ff"><%=pop3.messages.count%></font>封邮件。</td>
<%session("msgcount")=pop3.messages.count%>
</tr>
<tr>
<td align="center" width="20">号</td>
<td align="center" width="120">来自/回复</td>
<td align="center" width="270">主题</td>
<td align="center" width="90">日期</td>
<td align="center" width="60">大小</td>
<td align="center" width="20">选择</td>
</tr>
<%for i= sd to ed%>

<tr>
<td align="center" width="20"><%=i%></td>
<%
fw="回复:"+replace(pop3.messages.item(i).subject,space(1),"_")
%>
<td width="100">
<%receiver=pop3.messages.item(i).from%>
<%if pop3.messages.item(i).fromaddr="" then%>
<a href="">
<%else
%>
<a href=# onclick=javascript:window.open(sendmail1.asp?addr=<%=pop3.messages.item(i).fromaddr%>&subject=<%=fw%>,sendnew,width=600,height=480,scrollbars=yes);>
<%end if%>
<%if trim(receiver)="" then
response.write "匿 名</a>"%>
<%else%>
<a href=# onclick=javascript:window.open(sendmail1.asp?addr=<%=pop3.messages.item(i).fromaddr%>&subject=<%=fw%>,sendnew,width=600,height=480,scrollbars=yes);>
<font face="宋体" size="2">
<%=pop3.messages.item(i).from%></font>
<%end if%>
</td>
<td width="270">

<%msgid=pop3.getmessageid(i)%>
<a href="showbody1.asp?id=<%=msgid%>" target="frmbottom">
<font face="宋体" size="2">
<%
if trim(pop3.messages.item(i).subject)="" then
response.write "无主题"
else
response.write pop3.messages.item(i).subject
end if
%></font>
</a></td>
<td width="90"><font face="宋体" size="2"><%=cdate(mid(cstr(pop3.messages.item(i).date),6,11))%></font></td>

<td width="60"><font face="宋体" size="2"><%=pop3.messages.item(i).size%></font></td>
<td><input type="checkbox" name="c<%=i%>" value="<%=i%>"></td>
</tr>
<%next
pop3.disconnect

%>
</table>
</center>
<p align="center"><input type="button" name="cmdel" value="删除"></p>
</form>
<p align="center">
<table border="1" cellspacing="0" cellpadding="0" bordercolor="#ff0080" bgcolor="#ffffff">
<tr><td>页数</td>
<%for i=1 to pagenum%>
<td><a href="maillist1.asp?currentpage=<%=i%>" target=frmtop> <%=i%> </a></td>
<%next%>
</tr></table></p>

</body>
</html>