Question:
Here is my code to get the message
public Chilkat.Email GetMessage(string folder, int messageId, bool peek = false) { Chilkat.Email email = null;
try
{
login();
imap.PeekMode = peek;
assertSuccess(imap.SelectMailbox(folder));
email = imap.FetchSingle(messageId, UseUids);
assetNotNull(email);
}
finally
{
logout();
}
return email;
}
Here is my code to delete the email
public void MoveToFolder(Chilkat.MessageSet messageSet, string sourceFolder, string destinationFolder)
{
if (sourceFolder != destinationFolder)
{
try
{
login();
//message set contains sequence numbers
messageSet.HasUids = UseUids;
//set mailbox context
assertSuccess(imap.SelectMailbox(sourceFolder));
//copy messages to destination folder
assertSuccess(imap.CopyMultiple(messageSet, destinationFolder));
//delete messages from source folder
assertSuccess(imap.SetFlags(messageSet, FlagDeleted, 1));
//permanently removes from the currently selected mailbox all messages that have the Deleted flag set
assertSuccess(imap.Expunge());
}
finally
{
logout();
}
}
}
Now i delete a message with UID of 10 and then try and get a message with UID 10 fetch single still returns an empty email with an id of 10 and the flags are set to not deleted.
Why is it saying it recovered a deleted email when it clearly returned an empty email?
What is the actual value of your UseUids variable? If it is false, then you are using sequence numbers. If you delete sequence number 10, then on the next go-around, the email that was previously sequence number 11 will now be sequence number 10.