Problems with deleting IMAP mail

I’m using the Chilkat lib to access mail via IMAP. One customer tries to delete his mail without success. He sees the mail being deleted in Mail and then coming back. Unfortunately, I can’t reproduce the problem. I’ve no clue if the problem comes from the Chilkat lib, my code or even Mail.

Deleting mails isn’t complicated. The mailbox needs to be selected and then the deleted flag is added for the mail:

[code]Function deleteMail(currentMessage as Integer) As Boolean

if counter > NoOfMails then Return False
if MessageSet = nil then Return False

dim messageID as Integer = MessageSet.getID(counter - 1)

declare Function SetDeleteFlag lib ImapLibLocation selector “SetFlag:bUid:flagName:value:” (obj as Ptr, n as Ptr, fetchUuids as Boolean, _
flag as CFStringRef, value as Ptr) as Boolean
dim n as Cocoa.NSNumber = NSNumber.CreateWithInteger(messageID)
dim value as Cocoa.NSNumber = NSNumber.CreateWithInteger(1)

dim theResult as Boolean = SetDeleteFlag(self, n, True, “\Deleted”, value)
Return theResult

End Function[/code]

After adding verbose logging I can see that the delete is executed:

aaaf OK Fetch completed (0.000 secs).
----IMAP REQUEST----
aaag UID STORE 1 +FLAGS.SILENT (\Deleted)
----IMAP RESPONSE----
aaag OK Store completed (0.000 secs).

Any idea what could cause this?

Mac OS 10.11, Xojo 2015r4.

It might be Mail. I had issues with Mail deleting messages via IMAP and I wasn’t using any other kind of tools.
Have your client close Mail, then delete the message with your app, and check the server some other way (if using gmail, just check webmail.) I stopped using Mail some time ago because it was so problematic for me.

Further to what Tim says, ask your client to rebuild the relevant mailbox in Mail by selecting it, clicking the Mailbox menu and choosing Rebuild.

Thanks for the ideas. I’ll let the customer try that.

@Tim: I, too, think that this is a Mail issue.