VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
PFX
RSA Encryption
S/MIME
Socket
Spider
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Byte Array
VB.NET FTPS
System.IO

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

Process Large POP3 Mailbox

Demonstrates how to read email from a mailbox that may contain a large number of emails (on the order of thousands of emails or more).

Download Chilkat .NET for 2.0 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

'  The mailman object is used for receiving (POP3)
'  and sending (SMTP) email.
Dim mailman As New Chilkat.MailMan()

'  Any string argument automatically begins the 30-day trial.
Dim success As Boolean
success = mailman.UnlockComponent("30-day trial")
If (success <> true) Then
    MsgBox("Component unlock failed")
    Exit Sub
End If


'  Set the POP3 server's hostname
mailman.MailHost = "mail.chilkatsoft.com"

'  Set the POP3 login/password.
mailman.PopUsername = "myLogin"
mailman.PopPassword = "myPassword"

'  First, get the list of UIDLs for all emails in the mailbox.
Dim sa As Chilkat.StringArray
sa = mailman.GetUidls()
Dim i As Long
Dim numEmails As Long
numEmails = sa.Count

'  Download the emails in chunks of 10 emails each.
Dim chunkBeginIdx As Long
chunkBeginIdx = 0
Dim chunkEndIdx As Long
chunkEndIdx = 9
If (chunkEndIdx >= numEmails) Then
    chunkEndIdx = numEmails - 1
End If


Dim saChunk As New Chilkat.StringArray()
While (chunkEndIdx < (numEmails - 1))

    '  Build a chunk of 10 UIDLs.
    saChunk.Clear()
    For i = chunkBeginIdx To chunkEndIdx
        saChunk.Append(sa.GetString(i))
    Next

    '  Display the UIDLs in this chunk...
    Dim chunkStr As String
    chunkStr = saChunk.SaveToText()
    TextBox1.Text = TextBox1.Text & chunkStr & vbCrLf
    TextBox1.Text = TextBox1.Text & "----" & vbCrLf & vbCrLf

    '  Download this chunk of email from the POP3 server.
    Dim bundle As Chilkat.EmailBundle
    bundle = mailman.FetchMultiple(saChunk)
    If (bundle Is Nothing ) Then
        MsgBox(mailman.LastErrorText)
        Exit Sub
    End If


    '  Process the bundle...
    '  (your application's processing code goes here...)




    '  Get the next chunk...
    chunkBeginIdx += 10
    If (chunkBeginIdx >= numEmails) Then
        Exit For
    End If

    chunkEndIdx += 10
    If (chunkEndIdx >= numEmails) Then
        chunkEndIdx = numEmails - 1
    End If


End While


 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser