为imail和Mdaemon设计Webmail---读取邮件内容(showbody1.asp)

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

<%@ LANGUAGE="VBSCRIPT" %>
<%
'*********************************

'这是显示邮件内容窗口的文件,根据邮件列示窗口(maillist1.asp)传来的邮件ID来显示所选的邮件

'*********************************
%>


读邮件


<%
i=clng(Request.QueryString("id")) '要显示邮件的ID
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=300

x = POP3.Connect
If x <> 0 Then
Response.Write "

连接错误: " + CStr(x) + "

请和管理员联系"
POP3.Disconnect
Response.End
End If

x = POP3.DownloadMessages(0)
If x <> 0 Then
Response.Write "下载错误: " + CStr(x) +"

请和管理员联系"
POP3.Disconnect
Response.End
End If

Response.Write replace(POP3.Messages.item(i).bodytext,chr(13),"
") '显示邮件正文
Response.Write "


"

if pop3.messages.item(i).Attachments.Count>0 then '如果该邮件有附件
%>




<%
For k = 1 To pop3.messages.item(i).Attachments.Count '按附件数循环显示所有附件名
Response.Write (""
Next
%>
文件名大小
")%>
javascript:window.open('saveatt.asp?msgid=<%=i%>%26amp;attid=<%=k%>','getatt','width=640,height=480,scrollbars=yes');>
<%=pop3.Messages.item(i).Attachments(k).name%>

<%Response.Write cstr(pop3.Messages.item(i).Attachments(k).size)
Response.Write "

<%
end if
POP3.Disconnect
' Set POP3 = Nothing
%>