<% Set pop3 = Server.CreateObject( "JMail.POP3" )
pop3.Connect "username", "password", "pop3mail.intels.net"
' POP3的串連使用者名稱,密碼,POP3地址.
Response.Write( "你現在有" & pop3.count & " 封郵件。<br><br>" )
if pop3.count > 0 then
Set msg = pop3.Messages.item(1)
ReTo = ""
ReCC = ""
Set Recipients = msg.Recipients
separator = ", "
For i = 0 To Recipients.Count - 1
If i = Recipients.Count - 1 Then
separator = ""
End If
Set re = Recipients.item(i)
If re.ReType = 0 Then
ReTo = ReTo & re.Name & "(<a href=""mailto:"& re.EMail &""">" & re.EMail & "</a>)" &
separator
else
ReCC = ReTo & re.Name & "(<a href=""mailto:"& re.EMail &""">" & re.EMail & "</a>)" & separator
End If
Next
' 以上擷取所有收件者,並儲存.
Function getAttachments()
Set Attachments = msg.Attachments
separator = ", "
For i = 0 To Attachments.Count - 1
If i = Attachments.Count - 1 Then
separator = ""
End If
Set at = Attachments(i)
at.SaveToFile( "c:\intels\email\attachments\" & at.Filename )
getAttachments = getAttachments & "<a href=""/intels/email/attachments/" & at.Filename &""">" &_
at.FileName & "(" & at.Size & " bytes)" & "</a>" & separator
Next
End Function
' 以上是程式得到附件,並儲存到伺服器上,也可返回附件連結.
%>
<html>
<body>
<TABLE>
<tr>
<td>主題:撼雪噴雲向你問好!</td>
<td><%= msg.Subject %></td>
</tr>
<tr>
<td>寄件者:李雁冰@163.net</td>
<td><%= msg.FromName %></td>
</tr>
<tr>
<td>收件者:宋顏浩@163.net</td>
<td><%= ReTO %></td>
</tr>
<tr>
<td>抄送:申朝陽@163.net</td>
<td><%= ReCC %></td>
</tr>
<tr>
<td>附件:隨風起舞的傳說</td>
<td><%= getAttachments %></td>
</tr>
<tr>
<td>內容:烏裡哇啦烏裡哇啦……</td>
<td><pre><%= msg.body %></pre></td>
</tr>
</TABLE>
</body></html>
<% end if
pop3.Disconnect
%>
[1]