[RCD] How to query IMAP Flag from within a plugin?

Benoit Panizzon benoit.panizzon at imp.ch
Thu Aug 10 13:26:17 CEST 2017


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

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?

-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

More information about the dev mailing list