Roundcube Community Forum

 

Easy SpamAssassin Filtering

Started by Steve Corona, October 05, 2007, 02:40:16 PM

Previous topic - Next topic

skrieg

Hi,

Since RC2, the func file has completely changed. I cannot use the patch anymore :(

Thanks.

Jonn3

It does work. Just use Le Veilleur's file, and the optional modification below his post.

skrieg


Jonn3

There is one or two things though.
Have any of you problems deleting mail from Junk folder. If i delete a message, then go to Trash, and then go back to Junk again, it's still there.

The other stuff is in the log.

[29-Dec-2007 13:20:35] PHP Fatal error: Call to undefined function rcmail_deliver_message() in /home/httpd/html/roundcube/program/steps/mail/sendmail.inc on line 306

&

[28-Dec-2007 14:45:05] PHP Fatal error: Cannot redeclare rcmail_mailbox_list() (previously declared in /home/httpd/html/roundcube/program/include/main.inc:1595) in /home/httpd/html/roundcube/program/steps/mail/func.inc on line 144

Hopefully we can get a new file which is up to date...

Jonn3

Ok, with the old func.inc file, you can't send mail. We need an update for this asap.
Please check if you can send mail, and report back.

sphinx4

The last post is old, i know, but if also someone is wondering, why deleted junkmails never could be deletet, just add this code

if ( $mbox=='INBOX' ) {
if ( ( preg_match($CONFIG['spam_subject'],$cont) ) && ( $mbox != $CONFIG['junk_mbox'] ) ) {
$is_spam = 1;
}
}

to the patch.

Hope this helps someone.

Giulio

Is this patch works with 0.2 stable?

loop

Hello
In 0.2 stable I manually put lines like this into func.inc:
// START MODIFICATION (1 of 4)  BY [email protected] - SPAM FIX
[...]
// END MODIFICATION
Because when I replace func.inc Roundcube don't work. If someone want's I can do a patch file


But problem was in main.inc:
$rcmail_config['spam_subject'] = '***SPAM***';

I don't know how describe tag which puts Spamassassin. Listed above doesn't work.

Works:
$rcmail_config['spam_subject'] = 'SPAM';

But how to do something like this /^\*\*\*SPAM\*\*\*/ in that var?

Regards, Peter

fkw

Quote from: loop;17266I don't know how describe tag which puts Spamassassin. Listed above doesn't work.

Works:
$rcmail_config['spam_subject'] = 'SPAM';

But how to do something like this /^\*\*\*SPAM\*\*\*/ in that var?

Regards, Peter

Hello,

try something like this for ***SAPM***:
$rcmail_config['spam_subject'] = '/^\*\*\*SPAM\*\*\*/';

or you can also change the comment from SpamAssassin about your setting for the mailbox.

Regards, fkw

zamri

Does anyone prepare for 0.2stable patch of this plugin?

mark_valley

#25
Hello everyone. It seems there isn't no comments in this topic for a long time... :confused:

I work in a brazilian university and recently we adopted Roundcube 0.2 as our webmail client.  Well, spams are a huge problem here and we have lots of users complaining about some kind of spam filtering.

To resolve this e adapted the code presented in this topic and I could get the messages tagged by spamassassin moved to the junk folder.

The problem is that the Inbox unread counter isn“t updated until i click it for the second time and my users continue complaining... :mad:

In my code (inside rcmail_js_message_list function), it seems that the following line used to update INBOX doesn't work at all:

$OUTPUT->command('set_unread_count', 'INBOX', $IMAP->messagecount('INBOX', 'UNSEEN'));


I am a bit confused because after that line i added the following one to actualize the junk_box unread message counter and it worked pretty well:

$OUTPUT->command('set_unread_count', $CONFIG['junk_mbox'],         $IMAP->messagecount($CONFIG['junk_mbox'], 'UNSEEN'));


Can anyone help me?

PS.: If a solution was developed since 2007 I would be very glad to know.

woOtzee

It's sad this fix doesn't work anymore.

Will there any in the future ?
Spam is a big problem for me, i'm searching for a solution.

woOtzee

Ok.

I found a script by midnightz  ( http://www.roundcubeforum.net/plug-ins/2565-replacement-easy-spamassassin-filtering.html )

I just made it more simple :


You just have to edit ./program/steps/mail/func.inc, ~line 245

After :

  // create row for each message
  foreach ($a_headers as $i => $header)  //while (list($i, $header) = each($a_headers))
    {

Add :


  // ******************************************************
  // ADD by woOtzee.com SPAM FIX

   $spamfix_subject = Q(rcube_imap::decode_mime_string($header->subject, $header->charset));
   if ($mbox!=$CONFIG['trash_mbox'] && $mbox!=$CONFIG['junk_mbox']) {
     if (preg_match("'^\[SPAM\]'",$spamfix_subject) && !$header->seen) {
        $IMAP->move_message( array($header->uid), $CONFIG['junk_mbox'], $mbox );
        continue;
     }
   }

  // ADD by woOtzee.com SPAM FIX
  // ******************************************************


All unread mail marked as spam will be redirect to your junk box.
If you se a mail witch isn't spam in junk box, just mark it as read, and put it again
in the inbox box.

But, you need to clic on the mail icon on the top of the page to make it works.

If your spam tag isn't [SPAM] but, ***SPAM*** for exemple, like in the begin of
this post, just replace :
^\[SPAM\]
by :
/^\*\*\*SPAM\*\*\*/


Hope there's no mistake, it works for me !

lhwparis

Hello together,
is there now any Version of this SpamAssassin Filter which works definitivly with the newest roundcube version (0.2.1) ?
I use 0.1 untill now because i need this plugin :/

Thankst for your help.

dawn

@woOtzee: First of all thanks a lot for your fix. But do I overlook something? I've inserted your code (in my case for "***SPAM***") at the place you told, but I don't see anything happen. Do I add other code too? Is this really working for 0.2.1 stable?

   // **************************************************
    // ADD by woOtzee.com SPAM FIX

    $spamfix_subject = Q(rcube_imap::decode_mime_string($header->subject, $header->charset));

    if ($mbox!=$CONFIG['trash_mbox'] && $mbox!=$CONFIG['junk_mbox']) {
        if (preg_match("'/^\*\*\*SPAM\*\*\*/'",$spamfix_subject) && !$header->seen) {
            $IMAP->move_message( array($header->uid), $CONFIG['junk_mbox'], $mbox );
            continue;
        }
    }

    // ADD by woOtzee.com SPAM FIX
    // **************************************************

Best regards,
Dawn