|

DOWNLOAD
Reference
ASP Examples
Visual Basic Examples
Chilkat Mail Example
Save Email to a Zip file
This example shows how to save Emails 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: Save e-mails to a Zip file.</TITLE>
</HEAD>
<BODY>
Reading email....<br><br>
<%
' Create a Zip object.
' (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"
' Create the Zip file.
zip.NewZip "c:\email\zips\email.zip"
' You could open an existing Zip like this:
' zip.OpenZip "c:\email\zips\email.zip"
' Create a mailman
set mailman = Server.CreateObject("ChilkatMail.ChilkatMailMan")
' Get the UnlockCode free from http://www.chilkatsoft.com
mailman.UnlockComponent "unlock-code"
' Tell the mailman where to get mail (POP3 server), and the login/password
mailman.MailHost = "mail.myserver.com"
mailman.PopUsername = "my_login"
mailman.PopPassword = "my_password"
' Copy the mail without removing it from the server.
' When reading email, the mailman always returns a MailBundle
Set mailBundle = mailman.CopyMail
If Not (mailBundle Is Nothing) Then
' Append the emails to the Zip component (in memory)
if (mailBundle.AppendToZip(zip)) then
' Write the Zip out to disk.
zip.WriteZip
Response.write "Saved to Zip!<br>"
else
Response.write "Failed to append to Zip, check errors below."
end if
End If
Set mailBundle = Nothing
Set zip = Nothing
Set mailman = 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.
|
|