Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't set \Unseen flag #179

Open
DigitalCyberSoft opened this issue Feb 11, 2022 · 4 comments
Open

Can't set \Unseen flag #179

DigitalCyberSoft opened this issue Feb 11, 2022 · 4 comments
Labels
Bug Something isn't working

Comments

@DigitalCyberSoft
Copy link

Current requests for the body of an IMAP message don't perform a .PEEK request. As a result I've tried (along with a few variations)

$conn->setFlags($uid, ['\Unseen']);

Result is Exception: cannot set flags, have you tried to set the recent flag or special chars?

Setting a message as \Seen works fine.

Alternatively I overrode getRawContent to perform a RFC822.TEXT.PEEK rather than RFC822.TEXT, however this crashes out as well.

Is there either a way to PEEK a message or set it to unseen?

@DigitalCyberSoft DigitalCyberSoft added the Bug Something isn't working label Feb 11, 2022
@NIitrix
Copy link

NIitrix commented Mar 29, 2022

same issue here!

@NIitrix
Copy link

NIitrix commented Mar 29, 2022

I found a way to do it, you need to use the parameter $mode ('+' and '-') in function store in class Imap located here vendor/laminas/laminas-mail/src/Protocol/Imap.php

@DigitalCyberSoft
Copy link
Author

DigitalCyberSoft commented Apr 1, 2022

Cheers for that. Seem like there should be a way to get to that from setFlags

Anyway, workaround code:

class MyImap extends Laminas\Mail\Storage\Imap
{
        public function getProtocol()
        {
                return $this->protocol;
        }
}
$conn->getProtocol()->store(['\Seen'], $uid, null, '-');

To be run after anything like getMessage() or getRawContent()

@NIitrix
Copy link

NIitrix commented Apr 1, 2022

Yep! that will do the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants