|

DOWNLOAD
Reference
ASP Examples
Visual Basic Examples
Chilkat Mail Example
Read and Display Emails Stored in a Zip
File
This example shows how to read and display Emails
that were previously saved to a Zip file.
IMPORTANT: If Chilkat Mail
and Chilkat WebMail are separate components.
If you are using Chlilkat WebMail, the code is the same, but the
names of the components created are different. Use CreateObject("ChilkatWebMail.WebMailMan")
instead.
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Chilkat Mail Example: Read and display emails from a Zip file.</TITLE>
</HEAD>
<BODY>
<!-- Insert HTML here -->
Reading email from a Zip file....<br><br>
<%
' Create a new Zip file.
' (This must be Chilkat Zip version 4.0 or greater)
set zip = Server.CreateObject("ChilkatZip.ChilkatZip")
' Insert the call to UnlockComponent if the Zip component is licensed.
zip.UnlockComponent "unlock-code"
' Open the Zip file.
zip.OpenZip "c:\email\zips\email.zip"
' Create an empty mail bundle.
Set mailBundle = Server.CreateObject("ChilkatMail.ChilkatEmailBundle")
' Add emails to the bundle from the zip.
if (mailBundle.AddFromZip(zip)) then
For i = 0 To mailBundle.messageCount - 1
Set email = mailBundle.GetEmail(i)
Response.write "<hr><br><b>Message Number " & i & "</b><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
else
Response.write "Failed to get emails from Zip"
end if
Set mailBundle = Nothing
Set zip = Nothing
%>
<BR>DONE.<BR>
</BODY>
</HTML>
|
|