用EasyMailObject组件处理Exchange邮件源代码(2)
程序员文章站
2024-02-03 14:45:46
在asp中用easymailobject处理exchange邮件源代码---读取邮件内容和附件(showbody1.)<%@ language="vbscript" %><%***...
在asp中用easymailobject处理exchange邮件源代码---读取邮件内容和附件(showbody1.)
<%@ language="vbscript" %>
<%
************************************************
这个文件显示邮件的内容和附件
作者:awayeah
邮箱:awayeah@163.net
************************************************
%>
<html>
<head>
<title>读邮件</title>
</head>
<body>
<%
set pop3=session("pop3")
x = pop3.connect()
if x <> 0 then
response.write "连接错误: " + cstr(x)
pop3.disconnect
end if
y = pop3.downloadheaders
j=pop3.getmessagenumfromid(request.querystring("id"))
msg = pop3.downloadsinglemessage(j)
set message object to point to that downloaded message
set message = pop3.messages(msg)
显示邮件内容
response.write replace(message.bodytext,chr(13),"<br>")
%>
<%
如果该邮件有附件,则显示附件文件名和文件大小
if message.attachments.count>0 then%>
<p></p>
<hr>
<table border=1 align="left" cellspacing="0">
<tr><td>文件名</td><td>大小</td><tr>
<%
for k = 1 to message.attachments.count
response.write ("<tr><td>")%>
<a href=# onclick=javascript:window.open(saveatt.asp?msgid=<%=j%>&attid=<%=k%>,getatt,width=600,height=440,scrollbars=yes);>
<%=message.attachments(k).name%></a></td><td>
<%response.write cstr(message.attachments(k).size)
response.write "</td></tr>"
next
%>
</table>
<%
end if
pop3.disconnect
%>
</body>
</html>
<%@ language="vbscript" %>
<%
************************************************
这个文件显示邮件的内容和附件
作者:awayeah
邮箱:awayeah@163.net
************************************************
%>
<html>
<head>
<title>读邮件</title>
</head>
<body>
<%
set pop3=session("pop3")
x = pop3.connect()
if x <> 0 then
response.write "连接错误: " + cstr(x)
pop3.disconnect
end if
y = pop3.downloadheaders
j=pop3.getmessagenumfromid(request.querystring("id"))
msg = pop3.downloadsinglemessage(j)
set message object to point to that downloaded message
set message = pop3.messages(msg)
显示邮件内容
response.write replace(message.bodytext,chr(13),"<br>")
%>
<%
如果该邮件有附件,则显示附件文件名和文件大小
if message.attachments.count>0 then%>
<p></p>
<hr>
<table border=1 align="left" cellspacing="0">
<tr><td>文件名</td><td>大小</td><tr>
<%
for k = 1 to message.attachments.count
response.write ("<tr><td>")%>
<a href=# onclick=javascript:window.open(saveatt.asp?msgid=<%=j%>&attid=<%=k%>,getatt,width=600,height=440,scrollbars=yes);>
<%=message.attachments(k).name%></a></td><td>
<%response.write cstr(message.attachments(k).size)
response.write "</td></tr>"
next
%>
</table>
<%
end if
pop3.disconnect
%>
</body>
</html>
推荐阅读
-
用EasyMailObject组件处理Exchange邮件源代码(2)
-
在ASP中用EasyMailObject组件处理Exchange邮件源代码(6)
-
用EasyMailObject组件处理Exchange邮件源代码(5)
-
用EasyMailObject组件处理Exchange邮件源代码(6)
-
用EasyMailObject组件处理Exchange邮件源代码(4)
-
用EasyMailObject组件处理Exchange邮件源代码(7)
-
用EasyMailObject组件处理Exchange邮件源代码(1)
-
用EasyMailObject组件处理Exchange邮件源代码(3)
-
在ASP中用EasyMailObject组件处理Exchange邮件源代码(1)
-
在ASP中用EasyMailObject组件处理Exchange邮件源代码(2)