Листинг 6. Код ASP-страницы для вывода информации о содержимом
архива почты
<%@LANGUAGE="VBSCRIPT"%>
<HTML>
<HEAD>
<TITLE>Архив поступающей почты</TITLE>
</HEAD>
<BODY>
<H2>Архив поступающей почты</H2>
<HR>
<%
dim xmlDoc
dim msgNode
dim attachNode
dim returnAddress
set xmlDoc=createObject("Microsoft.XMLDOM")
xmlDoc.load "d:/xmlpro/mailbag.xml" 'server.mapPath("d:/xmlpro/mailbag.xml")
for each msgNode in xmlDoc.selectNodes("//mailItem")
response.write "<H4>"+msgNode.selectSingleNode( _
"subject").text+"</H4>"
for each attachNode in msgNode.selectNodes( _
"attachments/attachment")
response.write "<IMG SRC='" _
+ attachNode.selectSingleNode("pathName").text _
+ attachNode.selectSingleNode("fileName").text _
+ "'><br>"
next
response.write "<p>Адрес отправитель: "
set returnAddress = msgNode.selectSingleNode("senderEmail")
if not (returnAddress is nothing) then
response.write "<A HREF='"+returnAddress.text+"'>"
end if
response.write msgNode.selectSingleNode("sender").text
if not (returnAddress is nothing) then
response.write "</A>"
end if
response.write " / время получения "
response.write msgNode.selectSingleNode( _
"receivedTime").text
response.write "<pre>"+msgNode.selectSingleNode( _
"body").text+"</pre>"
response.write "<HR>"
next
%>
</BODY>
</HTML>