Skip to content

V5.5 Empty response error on delete function. #540

Open
@sertancayci-jf

Description

@sertancayci-jf

I will take inbox and message but when i tried delete or setFlag i take Empty response error message. i tried try catch but still take belowed error. Also i tried $message->delete(); , $message->delete(true) or $message->delete($expunge = true) . I always take same error Any help?

php: 8.3
php-imap: 5.5.0

Command failed to process:
Causes:
Empty response

`

$foundedMessage = null;
foreach($messages as $message){
echo "Message: " . PHP_EOL;
echo "Subject: " . $message->getSubject() . PHP_EOL;
echo "UID: " . $message->getUid() . PHP_EOL;
echo "Timestamp: " . $message->getDate() . PHP_EOL;
   if (trim($message->getSubject()) === trim($subject)) {
          $foundedMessage = $message;
          echo "Email found." . PHP_EOL;
          try {
              $message->setFlag("Deleted");
              echo "Email marked as deleted." . PHP_EOL;
          } catch (\Exception $e) {
              // Log the error or handle it appropriately
              echo "Failed to delete message: " . $e->getMessage();
          }
          break;
      }

}

`
Basic response:
Message:
Subject: subject
UID: 12345
Timestamp: 2025-01-02 09:33:10
Email found.
Failed to delete message: Command failed to process:
Causes:
- Empty response
Error occurred

Debug true response:
<< TAG1 OK [email protected] authenticated (Success)

TAG2 LIST "" "*"

<< * LIST (\HasNoChildren) "/" "INBOX"
<< * LIST (\HasChildren \Noselect) "/" "[Gmail]"
<< * LIST (\All \HasNoChildren) "/" "[Gmail]/All Mail"
<< * LIST (\Drafts \HasNoChildren) "/" "[Gmail]/Drafts"
<< * LIST (\HasNoChildren \Important) "/" "[Gmail]/Important"
<< * LIST (\HasNoChildren \Sent) "/" "[Gmail]/Sent Mail"
<< * LIST (\HasNoChildren \Junk) "/" "[Gmail]/Spam"
<< * LIST (\Flagged \HasNoChildren) "/" "[Gmail]/Starred"
<< * LIST (\HasNoChildren \Trash) "/" "[Gmail]/Trash"
<< TAG2 OK Success

TAG3 SELECT "INBOX"

<< * FLAGS (\Answered \Flagged \Draft \Deleted \Seen $NotPhishing $Phishing)
<< * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen $NotPhishing $Phishing *)] Flags permitted.
<< * OK [UIDVALIDITY 1] UIDs valid.
<< * 1 EXISTS
<< * 0 RECENT
<< * OK [UIDNEXT 12345] Predicted next UID.
<< * OK [HIGHESTMODSEQ 52847825]
<< TAG3 OK [READ-WRITE] INBOX selected. (Success)

TAG4 UID SEARCH ALL

<< * SEARCH 12345
<< TAG4 OK SEARCH completed (Success)

TAG5 UID FETCH 12345 (FLAGS)

<< * 1 FETCH (UID 12345 FLAGS ())
<< TAG5 OK Success

TAG6 UID FETCH 12345 (RFC822.HEADER)
<< FLAGS (\Seen))
<< * 1 FETCH (UID 12345 FLAGS (\Seen))
<< TAG7 OK Success

TAG8 UID STORE 12345:12345 -FLAGS.SILENT (\Seen)

<< * 1 FETCH (UID 12345 FLAGS ())
<< TAG8 OK Success

TAG9 UID FETCH 12345 (FLAGS)

<< * 1 FETCH (UID 12345 FLAGS ())
<< TAG9 OK Success
Message:
Subject: "subject"
UID: 12345
Timestamp: 2025-01-02 09:36:23
Email found.

TAG10 UID STORE 12345:12345 +FLAGS.SILENT (\Deleted)

<< * 1 EXPUNGE
<< * 0 EXISTS
<< TAG10 OK Success

TAG11 UID FETCH 12345 (FLAGS)

<< TAG11 OK Success
Failed to delete message: Command failed to process:
Causes:

  • Empty response
    Commands send:
    TAG11 UID FETCH 12345 (FLAGS)\r\n
    Responses received:
    TAG11 OK Success\r\n
    Error occurred>> TAG12 EXPUNGE

<< TAG12 OK Success

TAG13 LOGOUT

<< * BYE LOGOUT Requested
<< TAG13 OK 73 good day (Success)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions