Use EasyMailObject component to process Exchange mail source code in ASP--read mail content and attachments (showbody1.asp)
<%@ LANGUAGE="VBscript" %>
<%
'******************************************************
'This file shows the content and attachments of the email
'Author: awayeah
'Email: [email protected]
'******************************************************
%>
<html>
<head>
<title>Read email</title>
</head>
<body>
<%
SET POP3=session("POP3")
x = POP3.Connect()
If x <> 0 Then
Response.Write "Connection Error: " + 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)
'Show email content
Response.Write replace(Message.bodytext,chr(13),"<br>")
%>
<%
'If the message has an attachment, the attachment file name and file size will be displayed
if message.Attachments.Count>0 then%>
<P></p>
<hr>
<table border=1 align="left" cellpacing="0">
<tr><td>File name</td><td>Size</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>