Visual Basic Examples

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

VB Examples

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

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


VB Strings
VB Byte Array

 

 

 

 

 

 

 

Download Email Headers and Delete Selected Email

Download Chilkat Email ActiveX

Downloads email headers from a POP3 server and deletes emails with subjects containing certain substrings.

' Delete mail where the subject contains certain substrings
Private Sub Command1_Click()

    Dim mailman As New ChilkatMailMan2
    
    ' Anything begins the 30-day trial
    mailman.UnlockComponent "unlockCode"
    
    ' Set the POP3 hostname and loging username/password
    mailman.MailHost = "mail.chilkatsoft.com"
    mailman.PopUsername = "myLogin"
    mailman.PopPassword = "myPassword"
    
    ' Copy all mail headers.
    Dim bundle As ChilkatEmailBundle2
    Set bundle = mailman.GetAllHeaders(1)
    If (bundle Is Nothing) Then
        MsgBox mailman.LastErrorText
        Exit Sub
    End If
        
    Dim email As ChilkatEmail2
    For i = 0 To bundle.MessageCount - 1
        Set email = bundle.GetEmail(i)
        
        Debug.Print email.Subject
        List1.AddItem email.Subject
        
        ' This if for the sake of example.  It would make a very very
        ' poor SPAM filter...
        If (InStr(email.Subject, "Viagra")) Then
            ' Remove this email from the POP3 server.
            mailman.DeleteEmail email
            
        ElseIf (InStr(email.Subject, "Prescription Meds")) Then
            ' Remove this email from the POP3 server.
            mailman.DeleteEmail email
        
        ElseIf (InStr(email.Subject, "Human Growth Hormone")) Then
            ' Remove this email from the POP3 server.
            mailman.DeleteEmail email
        
        End If
        
    Next
    
    
End Sub


 

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