VB.NET Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML Conversion
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...
Amazon S3
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

 

 

 

 

 

 

Bounced Mail Handler

Download Chilkat .NET for 4.0 Framework

Download Chilkat .NET for 64-bit 4.0 Framework (x64)

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 64-bit 2.0 / 3.5 Framework (x64)

Download Chilkat .NET for 1.0 / 1.1 Framework

VB.NET sample source code showing how to create a bounced mail handler.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' The Chilkat Bounce component is used to classify an email as
        ' one of several types of automated replies such as bounced
        ' email messages, virus warnings, out-of-office replies, etc.
        ' To read email from a POP3 server, the Chilkat Mail component
        ' (licensed separately) is used.
        Dim success As Boolean

        Dim mailman As New Chilkat.MailMan()
        mailman.UnlockComponent("MailUnlockCode")
        mailman.MailHost = "mail.chilkatsoft.com"
        mailman.PopUsername = "login"
        mailman.PopPassword = "password"

        Dim bounce As New Chilkat.Bounce()
        success = bounce.UnlockComponent("BounceUnlockCode")
        If (success <> true) Then
            MsgBox(bounce.LastErrorText)
            Exit Sub
        End If

        ' Read email from the POP3 server.
        Dim bundle As Chilkat.EmailBundle
        bundle = mailman.CopyMail()
        If (Not (bundle Is Nothing)) Then

            ' Loop over each email...
            Dim email As Chilkat.Email
            Dim i As Long

            For i = 0 To bundle.MessageCount - 1
                email = bundle.GetEmail(i)

                ' See if this is a bounced email.
                ' This sets the properties of the Bounce object
                success = bounce.ExamineEmail(email)
                If (success = False) Then
                    ListBox1.Items.Add("Failed to classify email")
                ElseIf (bounce.BounceType = 0) Then
                    ' Not a bounce, skip it.
                ElseIf (bounce.BounceType = 1) Then
                    ' Hard bounce, log the email address
                    ListBox1.Items.Add("Hard Bounce: " & bounce.BounceAddress)
                ElseIf (bounce.BounceType = 2) Then
                    ' Soft bounce, log the email address
                    ListBox1.Items.Add("Soft Bounce: " & bounce.BounceAddress)
                ElseIf (bounce.BounceType = 3) Then
                    ' General bounce, no email address available.
                    ListBox1.Items.Add("General Bounce: No email address")
                ElseIf (bounce.BounceType = 4) Then
                    ' General bounce, log the email address
                    ListBox1.Items.Add("General Bounce: " & bounce.BounceAddress)
                ElseIf (bounce.BounceType = 5) Then
                    ' Mail blocked, log the email address
                    ListBox1.Items.Add("Mail Blocked: " & bounce.BounceAddress)
                ElseIf (bounce.BounceType = 6) Then
                    ' Auto-reply, log the email address
                    ListBox1.Items.Add("Auto-Reply: " & bounce.BounceAddress)
                ElseIf (bounce.BounceType = 7) Then
                    ' Transient (recoverable) Failure, log the email address
                    ListBox1.Items.Add("Transient Failure: " & bounce.BounceAddress)
                ElseIf (bounce.BounceType = 8) Then
                    ' Subscribe request, log the email address
                    ListBox1.Items.Add("Subscribe Request: " & bounce.BounceAddress)
                ElseIf (bounce.BounceType = 9) Then
                    ' Unsubscribe Request, log the email address
                    ListBox1.Items.Add("Unsubscribe Request: " & bounce.BounceAddress)
                ElseIf (bounce.BounceType = 10) Then
                    ' Virus Notification, log the email address
                    ListBox1.Items.Add("Virus Notification: " & bounce.BounceAddress)
                ElseIf (bounce.BounceType = 11) Then
                    ' Suspected bounce.
                    ' This should be rare.  It indicates that the Bounce
                    ' component found strong evidence that this is a bounced
                    ' email, but couldn't quite recognize everything it
                    ' needed to be 100% sure.  Feel free to notify
                    ' support@chilkatsoft.com regarding emails having this
                    ' bounce type.
                    ListBox1.Items.Add("Suspected Bounce!")
                End If

                email = Nothing

            Next

            bundle = Nothing

        End If

        mailman = Nothing

    End Sub


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

 
 

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

Mail Component · XML Parser