在ASP中用EasyMailObject組件處理Exchange郵件原始碼(2)

來源:互聯網
上載者:User
object|原始碼 讀取郵件內容和附件(showbody1.asp)
<%@ 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=<_25=j_25>&attid=<_25=k_25>','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>



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.