VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
PFX
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

Byte Array
VB.NET FTPS
System.IO

 

 

 

 

 

 

Read POP3 Mail in VB.NET

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

This VB.NET sample program shows how to read mail from a POP3 server.

    ' Read mail in VB.NET
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim mailman As New Chilkat.MailMan()
        mailman.UnlockComponent("UnlockCode")

        mailman.MailHost = "mail.chilkatsoft.com"
        mailman.PopPassword = "password"
        mailman.PopUsername = "login"

        ' Use CopyMail to leave email on the POP3 server,
        ' Use TransferMail to copy and remove it from the server.
        Dim bundle As Chilkat.EmailBundle
        bundle = mailman.CopyMail()

        TextBox1.Text = ""

        Dim i As Long
        For i = 0 To bundle.MessageCount - 1
            Dim email As Chilkat.Email
            email = bundle.GetEmail(i)

            ' Save attachments to the "attachments" directory.
            'email.SaveAllAttachments("attachments")

            TextBox1.Text = TextBox1.Text & "Email " & Str(i) & vbCrLf
            TextBox1.Text = TextBox1.Text & email.Subject & vbCrLf
            TextBox1.Text = TextBox1.Text & email.From & vbCrLf

            Dim j As Long
            For j = 0 To email.NumTo - 1
                TextBox1.Text = TextBox1.Text & "TO: " & email.GetTo(j) & vbCrLf
            Next

            ' Save the email to XML
            email.SaveXml("Email" & Str(i) & ".xml")

            ' Save the email to EML
            email.SaveEml("Email" & Str(i) & ".eml")

        Next
    End Sub
End Class

' ABOUT THIS EXAMPLE:
' This example shows how to read email in VB.NET
' How to download POP3 mail in VB.NET
' How to access POP3 email in VB.NET
' VB.NET source code to read mail
' VB.NET sample code to read email.


Important: The download for this example does not contain the ChilkatDotNet.dll which
must be downloaded and installed separately at http://www.chilkatsoft.com/downloads.asp.
Once installed, add a reference to the DLL in the project by following the instructions at
http://www.example-code.com/vbdotnet/step2.asp

 
 

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

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

Mail Component · XML Parser