Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

Index of Chilkat Blog Posts

December 26, 2007

DeleteBundle cannot delete all the emails?

I find this error when calling DeleteBundle:

    uidl_to_delete: 'ABC8923598739239123'
    Failed to find via UIDL

Why is this happening?

When the Chilkat MailMan downloads email from a POP3 server, it inserts an "X-UIDL" header field in the MIME so that it has a way to identify the email at a later time. (Sequential message numbers may change from session to session, but UIDLs should not.) The Chilkat.EmailBundle contains Chilkat.Email objects, each of which has an X-UIDL header (assuming it was downloaded directly from POP3 server using Chilkat).

If an email is deleted via some other means, and DeleteBundle is called at a later time, some of the emails may not still exist on the POP3 server, and you’ll receive these warning messages in the LastErrorText. Note: These are warnings and do not necessarily indicate an error.

If you still think there are problems, you may write a program to explicitly check the UIDLs in a POP3 mailbox. The GetUidls method may be called to do it. This VB.NET sample demonstrates calling GetUidls to fetch the UIDLs. It displays each UIDL, as well as the POP3 session log, which should also show the UIDLs. It also loads a previously saved email bundle and loops over the emails and displays the contents of each email’s X-UIDL header. You may use a program like this to determine if anything is amiss in the Chilkat component, or if the UIDL warnings are simply due to the fact that the emails no longer exist on the server.

    Private Sub CheckUidls()
        Dim mailman As New Chilkat.MailMan()
        Dim success As Boolean
        success = mailman.UnlockComponent("30-day trial")
        If (success <> True) Then
            MsgBox("Component unlock failed")
            Exit Sub
        End If
        '  Set the POP3 server's hostname
        mailman.MailHost = ""
        '  Set the POP3 login/password.
        mailman.PopUsername = ""
        mailman.PopPassword = "****"
        Dim sa As Chilkat.StringArray
        sa = mailman.GetUidls()
        Dim i As Long
        Dim n As Long
        n = sa.Count
        TextBox1.Text = TextBox1.Text & "UIDLS --------------" & vbCrLf
        For i = 0 To n - 1
            TextBox1.Text = TextBox1.Text & sa.GetString(i) & vbCrLf
        ' Show the POP3 session log, which shows the UIDL strings returned
        ' by the POP3 server.
        TextBox1.Text = TextBox1.Text & "POP3 Session Log --------------" & vbCrLf
        TextBox1.Text = TextBox1.Text & mailman.Pop3SessionLog & vbCrLf
        ' Load a previously saved email bundle (previously saved by calling Chilkat.EmailBundle.SaveXml)
        TextBox1.Text = TextBox1.Text & "UIDLS from bundle.xml --------------" & vbCrLf
        Dim bundle As New Chilkat.EmailBundle
        n = bundle.MessageCount
        If (n > 0) Then
            For i = 0 To n - 1
                Dim email As Chilkat.Email
                email = bundle.GetEmail(i)
                TextBox1.Text = TextBox1.Text & email.GetHeaderField("X-UIDL") & vbCrLf
        End If
    End Sub

Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.