Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

  

  Chilkat ActiveX Components

  Chilkat .NET Components

  Chilkat C++ Libraries

  

  

  

  

 

FAQ

DOWNLOAD ReferenceASP ExamplesVisual 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>


 

 


Privacy Statement. Copyright 2000-2008 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, and Windows 95/98/NT4.