
August 28th, 2003, 07:30 AM
|
|
Average Intelligence
|
|
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678
Time spent in forums: 10 m 22 sec
Reputation Power: 6
|
|
Code:
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Chilkat ASP Mail Example: Read a POP3 Mailbox</TITLE>
</HEAD>
<BODY>
Reading email....<br><br>
<%
' Create a mailman
set mailman = Server.CreateObject("ChilkatWebMail.WebMailMan")
' Unlock the component - use your trial or purchased unlock code.
mailman.UnlockComponent "unlock_code"
' Tell the mailman where to get mail, and the login/password
mailman.MailHost = Request.Form("popHostname")
mailman.PopUsername = Request.Form("loginName")
mailman.PopPassword = Request.Form("password")
' Copy the mail without removing it from the server.
' When reading email, the mailman always returns a MailBundle
Set mailBundle = mailman.CopyMail
' To Remove the mail from the server, use TransferMail:
' Set mailBundle = mailman.TransferMail
If Not (mailBundle Is Nothing) Then
' Loop over the email messages in the bundle
For i = 0 To mailBundle.messageCount - 1
Set email = mailBundle.GetEmail(i)
Response.write "<br>" & i & "<br>"
Response.write "<b>From:</b> " & Server.HTMLEncode(email.From) & "<br>"
Response.write "<b>Subject:</b> " & Server.HTMLEncode(email.Subject) & "<br>"
if email.NumTo = 0 then
Response.write "<b>To:</b> " & Server.HTMLEncode(email.GetTo(0)) & "<br>"
else
Response.write "<b>To:</b><blockquote>"
For j = 0 to email.NumTo
Response.write Server.HTMLEncode(email.GetTo(j)) & "<br>"
Next
Response.write "</blockquote><br>"
end if
'Response.write "<b>Raw Header:</b><br><pre>"
'Response.write Server.HTMLEncode(email.RawHeader)
'Response.write "</pre><br>"
Set email = Nothing
Next
End If
%>
<br>(View page source to see the log)
<XML ID="XMLID">
<%
Response.write mailman.GetInstanceLog()
%>
</XML>
<%
Set mailBundle = Nothing
' Standard ASP cleanup of objects
Set mailman = Nothing
%>
<BR>DONE.<BR>
</BODY>
</HTML>
|