VBScript Examples

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


VBScript Examples

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

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
Byte Array
RSS
Atom
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

 

Detect Bounced Email

Download Chilkat Email ActiveX

Download Chilkat Bounce ActiveX

VBScript showing how to detect a bounced email.

    set mailman = CreateObject("Chilkat.MailMan2")
    mailman.UnlockComponent "Anything for 30-day trial"
    mailman.MailHost = "mail.chilkatsoft.com"
    mailman.PopUsername = "matt@chilkatsoft.com"
    mailman.PopPassword = "myPassword"
    
    set bounce = CreateObject("Chilkat.Bounce")
    success = bounce.UnlockComponent("Anything for 30-day trial")
    if (success = 0) then
        MsgBox bounce.LastErrorText
        WScript.Quit
    end if
    
    ' Read email from the POP3 server.
    set bundle = CreateObject("ChilkatMail2.ChilkatEmailBundle2")
    Set bundle = mailman.CopyMail()
    
    bounceReport = ""
    
    If (Not (bundle Is Nothing)) Then
        
        ' Loop over each email...
        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
            success = bounce.ExamineMail(email)
            if (success = 0) then
                MsgBox bounce.LastErrorText
                WScript.Quit
            end if

            If (bounce.BounceType = 0) Then
                ' Not a bounce, skip it.
            ElseIf (bounce.BounceType = 1) Then
                ' Hard bounce, log the email address
                bounceReport = bounceReport & email.Subject & vbCrLf
                bounceReport = bounceReport & "Hard Bounce: " & bounce.BounceAddress & vbCrLf
            ElseIf (bounce.BounceType = 2) Then
                ' Soft bounce, log the email address
                bounceReport = bounceReport & email.Subject & vbCrLf
                bounceReport = bounceReport & "Soft Bounce: " & bounce.BounceAddress & vbCrLf
            ElseIf (bounce.BounceType = 3) Then
                ' General bounce, no email address available.
                bounceReport = bounceReport & email.Subject & vbCrLf
                bounceReport = bounceReport & "General Bounce: No email address" & vbCrLf
            ElseIf (bounce.BounceType = 4) Then
                ' General bounce, log the email address
                bounceReport = bounceReport & email.Subject & vbCrLf
                bounceReport = bounceReport & "General Bounce: " & bounce.BounceAddress & vbCrLf
            ElseIf (bounce.BounceType = 5) Then
                ' Mail blocked, log the email address
                bounceReport = bounceReport & email.Subject & vbCrLf
                bounceReport = bounceReport & "Mail Blocked: " & bounce.BounceAddress & vbCrLf
            ElseIf (bounce.BounceType = 6) Then
                ' Auto-reply, log the email address
                bounceReport = bounceReport & email.Subject & vbCrLf
                bounceReport = bounceReport & "Auto-Reply: " & bounce.BounceAddress & vbCrLf
            ElseIf (bounce.BounceType = 7) Then
                ' Transient (recoverable) Failure, log the email address
                bounceReport = bounceReport & email.Subject & vbCrLf
                bounceReport = bounceReport & "Transient Failure: " & bounce.BounceAddress & vbCrLf
            ElseIf (bounce.BounceType = 8) Then
                ' Subscribe request, log the email address
                bounceReport = bounceReport & email.Subject & vbCrLf
                bounceReport = bounceReport & "Subscribe Request: " & bounce.BounceAddress & vbCrLf
            ElseIf (bounce.BounceType = 9) Then
                ' Unsubscribe Request, log the email address
                bounceReport = bounceReport & email.Subject & vbCrLf
                bounceReport = bounceReport & "Unsubscribe Request: " & bounce.BounceAddress & vbCrLf
            ElseIf (bounce.BounceType = 10) Then
                ' Virus Notification, log the email address
                bounceReport = bounceReport & email.Subject & vbCrLf
                bounceReport = bounceReport & "Virus Notification: " & bounce.BounceAddress & vbCrLf
            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.
                bounceReport = bounceReport & email.Subject & vbCrLf
                bounceReport = bounceReport & "Suspected Bounce!" & vbCrLf
            End If
                        
        Next
        
        MsgBox bounceReport
        
    Else
        MsgBox mailman.LastErrorText
        
    End If
    

 

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

Mail Component · XML Parser