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

來源:互聯網
上載者:User
object|原始碼 讀取郵件主題和大小(maillist1.asp)
<%@ LANGUAGE="VBSCRIPT" %>
<%
'************************************************

'這個檔案列出所有郵件,並把郵件內容顯示視窗置為空白視窗
'作者:awayeah
'郵箱:awayeah@163.net

'************************************************
%>
<script language=vbscript>
parent.frmbottom.location.href="blank.htm"
sub cmdel_onClick()
'刪除郵件
frmail.submit
end sub
</script>
<%
if session("straccount")="" or session("strpassword")="" then
Response.write("<html><title>錯誤,尚未登入</title><body><p align=center><br><br>你尚未登入,請先退出登入!<br><br>")
Response.Write ("<a href='login.asp' target='_top'><img src='http://www.163design.net/a/f/logout.jpg' border=0></a></p></body></html>")
Response.End
end if
%>
<html>
<head>
<title>收郵件</title>
</head>
<STYLE>
<!--
A{text-decoration:none}
-->
</STYLE>
<body bgcolor="#008080" text="#000000">
<%
'定義郵件伺服器地址
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=120

x = POP3.Connect
If x <> 0 Then
Response.Write "<p align=center>串連錯誤: " + CStr(x) + "<br><br>請和管理員聯絡"
POP3.Disconnect
Response.End
End If

x = POP3.DownloadMessages(0)
If x <> 0 Then
Response.Write "下載錯誤: " + CStr(x) +"<br><br>請和管理員聯絡"
POP3.Disconnect
Response.End
End If%>
<p><br></p>
<form name="frmail" action="mail_prc.asp" method="POST">
<center>
<table border="1" width="580" cellspacing="0" cellpadding="0" bordercolor="#000080" bgcolor="#FFFFFF">
<tr><td colspan=6 align="center">
<%
'分頁處理
if Request.QueryString("currentpage")="" then
cp=1
else
cp=Request.QueryString("currentpage")
end if
'得到郵件總數
m_count=POP3.Messages.Count
if m_count<=10 then
pagenum=1
sd=1
ed=m_count
else
pagenum=int(m_count/10)+1
if clng(cp)<>pagenum then
lastpage=m_count mod 10
sd=(clng(cp)-1)*10+1
ed=clng(cp)*10
else
sd=(clng(cp)-1)*10+1
ed=m_count
end if
end if
%>
你有<font color="ff00ff"><%=POP3.Messages.Count%></font>封郵件。</td>
<%session("msgcount")=POP3.Messages.Count%>
</tr>
<tr>
<td align="center" width="20">號</td>
<td align="center" width="120">來自/回複</td>
<td align="center" width="270">主題</td>
<td align="center" width="90">日期</td>
<td align="center" width="60">大小</td>
<td align="center" width="20">選擇</td>
</tr>
<%for i= sd to ed%>

<tr>
<td align="center" width="20"><%=i%></td>
<%
fw="回複:"+replace(POP3.messages.item(i).subject,space(1),"_")
%>
<td width="100">
<%receiver=POP3.Messages.item(i).from%>
<%if POP3.Messages.item(i).fromaddr="" then%>
<a href="">
<%else
%>
<a href=# onClick=javascript:window.open('sendmail1.asp?addr=<%=pop3.messages.item(i).fromaddr%>&subject=<%=fw%>','sendnew','width=600,height=480,scrollbars=yes');>
<%end if%>
<%if trim(receiver)="" then
response.write "匿 名</a>"%>
<%else%>
<a href=# onClick=javascript:window.open('sendmail1.asp?addr=<%=pop3.messages.item(i).fromaddr%>&subject=<%=fw%>','sendnew','width=600,height=480,scrollbars=yes');>
<font face=&quo



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.