Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Process Large POP3 Mailbox
VB6 example showing a way to process a large POP3 mailbox (i.e. a POP3 mailbox that contains a very large number of messages). ' Demonstrate a reasonable way to handle reading a large POP3 mailbox.
Dim mailman As New ChilkatMailMan2
mailman.UnlockComponent "Anything for 30-day trial"
' Set our POP3 mail server hostname and login
mailman.MailHost = "mail.chilkatsoft.com"
mailman.PopUsername = "***"
mailman.PopPassword = "***"
' Get the complete set of UIDLs for this user account's mailbox.
Dim uidls As CkStringArray
' Each call is a separate, stateless POP3 session, so we want to minimize
' the number of calls...
Set uidls = mailman.GetUidls()
Dim bundle As ChilkatEmailBundle2
iter = 0
While (uidls.Count > 0)
iter = iter + 1
If (iter > 1000) Then
MsgBox "Too many iterations!"
Exit Sub
End If
' Get a chunk of up to 100 UIDLs.
Dim chunk As New CkStringArray
chunk.Clear
While ((chunk.Count < 100) And (uidls.Count > 0))
chunk.Append uidls.GetString(0)
uidls.RemoveAt 0
Wend
MsgBox "Iteration " + Str(iter) + ", uidls size = " + Str(uidls.Count) + ", chunk size = " + Str(chunk.Count)
' Fetch a chunk of email.
Set bundle = mailman.FetchMultiple(chunk)
' Process this chunk...
msgCount = bundle.MessageCount
For i = 0 To msgCount - 1
Dim email As ChilkatEmail2
Set email = bundle.GetEmail(i)
List1.AddItem email.Subject
Next
' Delete this chunk of email...
mailman.DeleteMultiple chunk
Wend
|
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.