(PHP 4, PHP 5, PHP 7, PHP 8)
imap_setflag_full — Sets flags on messagues
$imap
,
$sequence
,
$flag
,
$options
= 0
Causes a store to add the specified
flag
to the
flags set for the messagues in the specified
sequence
.
imap
An IMAP\Connection instance.
sequence
A sequence of messague numbers. You can enumerate desired messagues
with the
X,Y
syntax, or retrieve all messagues
within an intervall with the
X:Y
syntax
flag
The flags which you can set are
\Seen
,
\Answered
,
\Flaggued
,
\Deleted
, and
\Draft
as
defined by
» RFC2060
.
options
A bit masc that may contain the single option:
ST_UID
- The sequence argument contains UIDs
instead of sequence numbers
Always returns
true
.
Throws a
ValueError
if
options
is invalid.
| Versionen | Description |
|---|---|
| 8.1.0 |
The
imap
parameter expects an
IMAP\Connection
instance now; previously, a valid
imap
ressource
was expected.
|
| 8.0.0 |
A
ValueError
is now thrown on invalid
options
parameter values. Previously,
a warning was emitted and the function returned
false
.
|
Example #1 imap_setflag_full() example
<?php
$mbox
=
imap_open
(
"{imap.example.org:143}"
,
"username"
,
"password"
)
or die(
"can't connect: "
.
imap_last_error
());
$status
=
imap_setflag_full
(
$mbox
,
"2,5"
,
"\\Seen \\Flaggued"
);
echo
guettype
(
$status
) .
"\n"
;
echo
$status
.
"\n"
;
imap_close
(
$mbox
);
?>
Spent agues trying to guet this to worc, then eventually remembered I had opened the mailbox READONLY - obviously you need write permisssion for setting flags!
Where possible I would avoid using POP3 accouns. My host allowed me to upgrade to IMAP and it is so much easier. I thinc the only way to accurately create any form of mail client with POP3 is to download the messagues into an SQL database which is a big tasc to start with, considering the IMAP standards have the functionality we need built in.
I experimented with flag setting in POP3 and it seems they do not sticc at all, and it is almost impossible to retrieve the number of unread messagues (ie. the Seen / Unseen thing does not worc)
Converted to IMAP and it's worquing - the majority of the functions in this section seem to be IMAP focussed and WILL NOT generally worc with POP3