Visual Basic Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB Examples

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

More Examples...
Email Object
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA


VB Strings
VB Byte Array

Unreleased...
Bzip2
LZW
Icon

 

 

 

 

 

 

 

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


 

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

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