Req #39440 [Com]: Custom IMAP flags cannot be fetched
| From: | bp at imp dot ch | Date: | Fri, 11 Aug 2017 14:35:32 +0000 |
| Subject: | Req #39440 [Com]: Custom IMAP flags cannot be fetched | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210611@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=39440&edit=1
ID: 39440
Comment by: bp at imp dot ch
Reported by: loikiolki at yahoo dot ca
Summary: Custom IMAP flags cannot be fetched
Status: Open
Type: Feature/Change Request
Package: Feature/Change Request
Operating System: Windows XP
PHP Version: 5.2.0
Block user comment: N
Private report: N
New Comment:
Just look at perl:
my $imap = Net::IMAP::Simple->new('imap.example.com', SSL_version => 'SSLv3
SSLv2 TLSv1', use_ssl => 0) ||
die "Unable to connect to IMAP: $Net::IMAP::Simple::errstr\n";
if(!$imap->login('user@example.com','passw0rd')){
print STDERR "Login failed: " . $imap->errstr . "\n";
exit(64);
}
print "Available server flags: " . join(", ", $imap->flags) .
"\n";
my @ids = $imap->search("SUBJECT \"V14gr4\" ");
my $count = scalar @ids;
print "Emails found: $count\n";
foreach (@ids) {
my $flags = $imap->msg_flags($_);
print "Flags on message $_: $flags\n";
}
-----------
This results in an output like this showing all the flags, including the ones set with RoudCube
using PHP:
Emails found: 1
Flags on message 30: \Seen JUNK
Previous Comments:
------------------------------------------------------------------------
[2017-08-11 14:09:34] bp at imp dot ch
Same Problem here with a custom plugin to the widely used RoundCube Webmail Client.
The plugin report_junk does set a custom flag 'JUNK' to mark which emails habe been
reported as junk.
But lacking and function to query for a custom email flag, it cannot detect if an email is already
labeled junk and allows the user to report the same spam mail multiple times. Now what you want when
your 'backend' scripts do generate an ARF report to the ISP of the sender.
Please do implement a php imap function to get all flags or query for the presence of a flag.
like
* imap_get_flags($mbox, $msg_id)
* imap_has_flag($mbox,$msg_id, 'JUNK')
------------------------------------------------------------------------
[2017-07-19 15:18:13] christof dot kudla at kudla dot info
It is possible to use the Zend framework as a workaround. To check for flags,
Zend\Mail\Storage\Message has a method called hasFlag(). With getFlags() you'll get all flags.
------------------------------------------------------------------------
[2011-01-19 14:02:39] krisha at tvnet dot lv
Will anyone ever fix this bug? :(
There for ages and still in 5.3..
------------------------------------------------------------------------
[2006-11-09 01:28:53] loikiolki at yahoo dot ca
Description:
------------
None of the existing IMAP functions built into PHP support fetching custom IMAP flags. Existing
functions imap_setflag_full and imap_clearflag_full allow one to set custom flags, but there is no
method available to fetch them back.
Reproduce code:
---------------
<?
// clear custom flag
imap_setflag_full($mbox, $msg_id, '$Label2');
// set custom flag
imap_setflag_full($mbox, $msg_id, '$Label1');
// fetch the flag - we need this!
if (imap_fetchflag_full($mbox, $msg_id, '$Label1'))
echo "Flag \$Label1 is set\n";
else
echo "Flag \$Label1 is not set\n";
// also, maybe include custom flags in functions
// such as imap_headerinfo() to fetch all set flags
// (not sure if this is possible with IMAP protocol)
Expected result:
----------------
Flag $Label1 is set
Actual result:
--------------
Fatal error: Call to undefined function imap_fetchflag_full() in Command line code on line 1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=39440&edit=1