Sample code for 30+ languages & platforms
VBScript

Transition from MailMan.CopyMail to MailMan.FetchAll

Provides instructions for replacing deprecated CopyMail method calls with FetchAll.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

set mailman = CreateObject("Chilkat.MailMan")

' ...
' ...

' ------------------------------------------------------------------------
' The CopyMail method is deprecated:

' bundleObj is a Chilkat.EmailBundle
Set bundleObj = mailman.CopyMail()
If (mailman.LastMethodSuccess = 0) Then
    outFile.WriteLine(mailman.LastErrorText)
    WScript.Quit
End If

' ...
' ...

' ------------------------------------------------------------------------
' Do the equivalent using FetchAll.
' Your application creates a new, empty EmailBundle object which is passed 
' in the last argument and filled upon success.

keepOnServer = 1
headersOnly = 0
' Irrelevent because we are not downloading headers-only.
numBodyLines = 0

set bundleOut = CreateObject("Chilkat.EmailBundle")
success = mailman.FetchAll(keepOnServer,headersOnly,numBodyLines,bundleOut)
If (success = 0) Then
    outFile.WriteLine(mailman.LastErrorText)
    WScript.Quit
End If


outFile.Close