Answer the question
In order to leave comments, you need to log in
C++/CLI IMAP work using chilkat library, delete message?
I'm trying to delete a message from the mailbox and it doesn't work. Authorization is successful, the mailbox is selected, but the messages are not deleted, although when you put the deletion in a cycle, they are deleted, but it would be necessary that it be piece by piece, maybe someone knows how to do this? Thanks
Here is the code:
CkMessageSet* messageSet = 0;
bool fetchUids = true;
// Get the message IDs for all emails having "FTP2" in the subject.
messageSet = imap.Search("SUBJECT FTP2", fetchUids);
if (imap.get_LastMethodSuccess() == false) {
std::cout << imap.lastErrorText() << "\r\n";
return;
}
// Set the Deleted flag for each message:
success = imap.SetFlags(*messageSet, "Deleted", checkedListBox1->SelectedIndex);
if (success != true) {
std::cout << imap.lastErrorText() << "\r\n";
return;
}
// Expunge and close the mailbox.
success = imap.ExpungeAndClose();
if (success != true) {
std::cout << imap.lastErrorText() << "\r\n";
return;
}
// Display the session log.
std::cout << imap.sessionLog() << "\r\n";
// Disconnect from the IMAP server.
success = imap.Disconnect();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question