Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Visual FoxPro) Process Large POP3 MailboxDemonstrates how to read email from a mailbox that may contain a large number of emails.
LOCAL loMailman LOCAL loSa LOCAL i LOCAL lnNumEmails LOCAL lnChunkSize LOCAL lnChunkBeginIdx LOCAL lnChunkEndIdx LOCAL loSaChunk LOCAL lcChunkStr LOCAL loBundle * This example requires the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.MailMan') loMailman = CreateObject('Chilkat.MailMan') loMailman.MailHost = "pop.example.com" loMailman.PopUsername = "myLogin" loMailman.PopPassword = "myPassword" loMailman.MailPort = 995 loMailman.PopSsl = 1 * Get the list of UIDLs for all emails in the mailbox. loSa = loMailman.GetUidls() IF (loMailman.LastMethodSuccess = 0) THEN ? loMailman.LastErrorText RELEASE loMailman CANCEL ENDIF lnNumEmails = loSa.Count IF (lnNumEmails = 0) THEN ? "Mailbox is empty" RELEASE loMailman CANCEL ENDIF lnChunkSize = 6 * Download the emails in chunks of 6 emails each. lnChunkBeginIdx = 0 lnChunkEndIdx = lnChunkSize - 1 IF (lnChunkEndIdx >= lnNumEmails) THEN lnChunkEndIdx = lnNumEmails - 1 ENDIF * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringArray') loSaChunk = CreateObject('Chilkat.StringArray') DO WHILE (lnChunkBeginIdx < lnNumEmails) ? STR(lnChunkBeginIdx) + " to " + STR(lnChunkEndIdx) * Build a chunk of UIDLs. loSaChunk.Clear() FOR i = lnChunkBeginIdx TO lnChunkEndIdx loSaChunk.Append(loSa.GetString(i)) NEXT * Log the UIDLs in this chunk... lcChunkStr = loSaChunk.SaveToText() ? lcChunkStr * Download this chunk of email from the POP3 server. loBundle = loMailman.FetchMultiple(loSaChunk) IF (loMailman.LastMethodSuccess = 0) THEN ? loMailman.LastErrorText RELEASE loMailman RELEASE loSaChunk CANCEL ENDIF ? "Downloaded " + STR(loBundle.MessageCount) + " emails." ? "----" * Process the bundle... * (your application's processing code goes here...) RELEASE loBundle * Get the next chunk... lnChunkBeginIdx = lnChunkBeginIdx + lnChunkSize lnChunkEndIdx = lnChunkEndIdx + lnChunkSize IF (lnChunkEndIdx >= lnNumEmails) THEN lnChunkEndIdx = lnNumEmails - 1 ENDIF ENDDO RELEASE loSa RELEASE loMailman RELEASE loSaChunk |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.