Hi
We use the (slightly enhanced) report_junk plug-in to feed customer spam reports to our spamfilter learning and blacklisting infrastructure. Reports from customer do also get processed to an automated ARF message being sent to the abuse contact of the sender ISP.
If a customer reports an email as spam, the appropriate JUNK imap flag is set.
$rcmail->imap->unset_flag($uids, 'NONJUNK');
$rcmail->imap->set_flag($uids, 'JUNK');
Now unfortunately these flags are not being checked before a customer hits 'report as spam', thus allowing a customer to report the same email multiple times.
While multiple customers sending emails about the same spam source resulting in multiple complaints to the ISP of the sender is desired and hopefully helps the ISP to decide if his customer is sending spam, it is not desired, that a customer does report the same email again and again.
So what is the way to check for presence of an IMAP flag within a rc plugin to do something like:
if ($rcmail->imap->flag['JUNK']) { display popup: "You have already reported this email"; }
And is there also an easy way to check the reception date of an email to prevent customers from reporting 'old' spam mails?
I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________
Well, I'm giving up.
After consulting the PHP online manual on IMAP Flags and only finding functions to set and clear flags, but not to query then.
And then after further research, stumbling over this article:
https://stackoverflow.com/questions/32851152/how-to-read-apple-mail-custom-i...
Stating:
"Actually you are not able to do so using standard imap extension as it is impossible to fetch custom flags using it."
I suppose custom flags support has not been built into roundcube. If it is I would be glad if someone could correct me.
Therefore I wonder, why plugins linke report_junk set the 'JUNK' flag if there is no way to query this flag from within roundcube.
I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________
Hello Benoit
It's probably worth to look a the thunderbird_labels plugin for Roundcube [1]. It uses IMAP flags to store custom labels. Custom flags need to be supported by the IMAP server with the PERMANENTFLAGS capability. You can check this with the following command from within a plugin:
$this->rc->storage->check_permflag('Junk') || $RCMAIL->storage->check_permflag('*');
Then setting and unsetting those flags should be possible.
In order to check a certain flag, you have to test it in the message object and not the IMAP storage instance in Roundcube. Do this in one of the message hooks like message_load [2] or messages_list [3]:
if (!empty($message->headers->flags['Junk']))
I hope this helps you to proceed.
Best, Thomas
[1] https://github.com/mike-kfed/rcmail-thunderbird-labels [2] https://github.com/roundcube/roundcubemail/wiki/Plugin-Hooks#message_load [3] https://github.com/roundcube/roundcubemail/wiki/Plugin-Hooks#messages_list
On Fri, Aug 11, 2017 at 4:00 PM, Benoit Panizzon benoit.panizzon@imp.ch wrote:
Well, I'm giving up.
After consulting the PHP online manual on IMAP Flags and only finding functions to set and clear flags, but not to query then.
And then after further research, stumbling over this article:
https://stackoverflow.com/questions/32851152/how-to-read-apple-mail-custom-i...
Stating:
"Actually you are not able to do so using standard imap extension as it is impossible to fetch custom flags using it."
I suppose custom flags support has not been built into roundcube. If it is I would be glad if someone could correct me.
Therefore I wonder, why plugins linke report_junk set the 'JUNK' flag if there is no way to query this flag from within roundcube.
-Benoît Panizzon-
I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________ _______________________________________________ Roundcube Development discussion mailing list dev@lists.roundcube.net http://lists.roundcube.net/mailman/listinfo/dev
Hi Thomas
Thank you for your reply.
It's probably worth to look a the thunderbird_labels plugin for Roundcube [1]. It uses IMAP flags to store custom labels. Custom flags need to be supported by the IMAP server with the PERMANENTFLAGS capability. You can check this with the following command from within a plugin:
Thank you, Brendan already pointed out to me, that custom flags retrieval support is built in in RC via list_flags function.
$this->rc->storage->check_permflag('Junk') || $RCMAIL->storage->check_permflag('*');
Then setting and unsetting those flags should be possible.
In order to check a certain flag, you have to test it in the message object and not the IMAP storage instance in Roundcube. Do this in one of the message hooks like message_load [2] or messages_list [3]:
if (!empty($message->headers->flags['Junk']))
Yes I had a look at this function.
Unfortunately, as far as I have found out, custom flags are not returned nor queried by the header->flags function. But list_flags looks promising, my first test dumped all the custom flags of the messages submitted to that function. Now I just have to build some logic around to filter out the already reported (flagged as JUNK) messages from the array the of msg_id's the customer is reporting. I suppose I will get that done today :-)
I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________