Visual Basic Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB Examples

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

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


VB Strings
VB Byte Array

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

 

 

 

 

 

 

 

Bounced Email Handler

Download Chilkat Email ActiveX

Download Chilkat Bounce ActiveX

VB6 sample source code showing how to create a bounced email handler.

' 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.
Private Sub Command1_Click()

    Dim mailman As New ChilkatMailMan2
    mailman.UnlockComponent "MailUnlockCode"
    mailman.MailHost = "mail.chilkatsoft.com"
    mailman.PopUsername = "matt@chilkatsoft.com"
    mailman.PopPassword = "myPassword"
    
    Dim bounce As New ChilkatBounce
    bounce.UnlockComponent "BounceUnlockCode"
    
    ' Read email from the POP3 server.
    Dim bundle As ChilkatEmailBundle2
    Set bundle = mailman.CopyMail()
    If (Not (bundle Is Nothing)) Then
        
        ' Loop over each email...
        Dim email As ChilkatEmail2
        For i = 0 To bundle.MessageCount - 1
            Set email = bundle.GetEmail(i)
            
            ' See if this is a bounced email.
            ' This sets the properties of the Bounce object
            bounce.ExamineMail email
            
            If (bounce.BounceType = 0) Then
                ' Not a bounce, skip it.
            ElseIf (bounce.BounceType = 1) Then
                ' Hard bounce, log the email address
                List1.AddItem email.Subject
                List1.AddItem "Hard Bounce: " & bounce.BounceAddress
            ElseIf (bounce.BounceType = 2) Then
                ' Soft bounce, log the email address
                List1.AddItem email.Subject
                List1.AddItem "Soft Bounce: " & bounce.BounceAddress
            ElseIf (bounce.BounceType = 3) Then
                ' General bounce, no email address available.
                List1.AddItem email.Subject
                List1.AddItem "General Bounce: No email address"
            ElseIf (bounce.BounceType = 4) Then
                ' General bounce, log the email address
                List1.AddItem email.Subject
                List1.AddItem "General Bounce: " & bounce.BounceAddress
            ElseIf (bounce.BounceType = 5) Then
                ' Mail blocked, log the email address
                List1.AddItem email.Subject
                List1.AddItem "Mail Blocked: " & bounce.BounceAddress
            ElseIf (bounce.BounceType = 6) Then
                ' Auto-reply, log the email address
                List1.AddItem email.Subject
                List1.AddItem "Auto-Reply: " & bounce.BounceAddress
            ElseIf (bounce.BounceType = 7) Then
                ' Transient (recoverable) Failure, log the email address
                List1.AddItem email.Subject
                List1.AddItem "Transient Failure: " & bounce.BounceAddress
            ElseIf (bounce.BounceType = 8) Then
                ' Subscribe request, log the email address
                List1.AddItem email.Subject
                List1.AddItem "Subscribe Request: " & bounce.BounceAddress
            ElseIf (bounce.BounceType = 9) Then
                ' Unsubscribe Request, log the email address
                List1.AddItem email.Subject
                List1.AddItem "Unsubscribe Request: " & bounce.BounceAddress
            ElseIf (bounce.BounceType = 10) Then
                ' Virus Notification, log the email address
                List1.AddItem email.Subject
                List1.AddItem "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.
                List1.AddItem email.Subject
                List1.AddItem "Suspected Bounce!"
            End If
                        
            Set email = Nothing
            
        Next
    
        Set bundle = Nothing
    
    Else
        MsgBox mailman.LastErrorText
        
    End If
    
    Set mailman = Nothing
    
End Sub

 

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

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