A
A
Alexander Rychkov2020-03-16 08:43:58
IMAP
Alexander Rychkov, 2020-03-16 08:43:58

C++/CLI chilkat, delete message. Has anyone worked with her?

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();


cout are made for convenience while the program is being made, later all this will be displayed in a special textbox with logs.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question