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

 

 

 

 

 

 

Delete Individual Emails from POP3 Mailbox

Demonstrates how to delete individual emails from a POP3 mailbox.

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

'  The mailman object is used for receiving (POP3)
'  and sending (SMTP) email.
Dim mailman As New Chilkat.MailMan()

'  Any string argument automatically begins the 30-day trial.
Dim success As Boolean
success = mailman.UnlockComponent("Anything for 30-day trial")
If (success <> true) Then
    MsgBox("Component unlock failed")
    Exit Sub
End If


'  Set the POP3 server's hostname
mailman.MailHost = "mail.chilkatsoft.com"

'  Set the POP3 login/password.
mailman.PopUsername = "myLogin"
mailman.PopPassword = "myPassword"

'  Set the ImmediateDelete property = False
'  When the DeleteEmail method is called, the POP3 session
'  will remain open and the emails will be deleted all at once
'  when the session closes.
mailman.ImmediateDelete = false

Dim bundle As Chilkat.EmailBundle

'  Download email headers.
bundle = mailman.GetAllHeaders(1)

If (bundle Is Nothing ) Then
    MsgBox(mailman.LastErrorText)
    Exit Sub
End If


Dim i As Long
Dim email As Chilkat.Email
For i = 0 To bundle.MessageCount - 1
    email = bundle.GetEmail(i)

    TextBox1.Text = TextBox1.Text & email.From _
         & vbCrLf & vbCrLf
    TextBox1.Text = TextBox1.Text & email.Subject _
         & vbCrLf & vbCrLf

    '  If you decide the email is to be deleted, call DeleteEmail.
    '  This marks the email for deletion on the POP3 server.
    success = mailman.DeleteEmail(email)
    If (success <> true) Then
        MsgBox(mailman.LastErrorText)
        Exit Sub
    End If



Next

'  Make sure the POP3 session is ended to finalize the deletes.
success = mailman.Pop3EndSession()
If (success <> true) Then
    MsgBox(mailman.LastErrorText)
End If



MsgBox("Success!")
 

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

Mail Component · XML Parser