[imp] How to flag only one message as "\flagged" with Horde Imap Client library

Michael M Slusarz slusarz at horde.org
Fri Mar 20 07:57:58 UTC 2015


Quoting Kristers Zariņš <sharrpenized at gmail.com>:

> I'm trying to flag message with the imap flag "\flagged". The problem is
> that not only the message I intended to mark gets flagged, but also all
> other messages which were sent from the same email address are also flagged.
>
> For example, in my mailbox I have 10 messages from example at host.com. I want
> to mark only one of them as "flagged", so I get it's uid and send a
> request. But it marks all 10 messages. I want only that one with the
> specific uid.
>
> I'm working with gmail account. When flagging messages in gmail's webmail
> itself, it marks only one message as intended, so it's not a weird feature
> from gmail itself.

Not true.  Gmail's IMAP semantics do *not* follow normal IMAP  
semantics (at least with things like the delete flag), so it is quite  
possible that things are broken on the Gmail side.

> The code I'm using is below. What's the problem?
>
> $uids = new Horde_Imap_Client_Ids([1521]);//uid of message I want to mark
> as flagged
>
> $options = [
>     'uids' => $uids,
>     'add' => ['\flagged'],

Really should be 'add' => array(Horde_Imap_Client::FLAG_FLAGGED)

> ];
>
> $Imap_Client_Socket->store('INBOX', $options);

looks correct.  The 'debug' option to the Horde_Imap_Client_Base  
constructor is your friend - this is exactly the reason it is there;  
you can look to see what IMAP commands are really being sent.

michael


___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the imp mailing list