Miscellaneous > Roundcube Discussion

Filtering Spam to "Junk" Folder?

(1/2) > >>

Eleventeen:
Hi, I'm using Mailscanner to scan my email for spam, but I'm wondering how I would go about moving those marked messages into the Junk folder (or any folder for that matter)? Thanks for any help you guys can give! :)

timelord:
I have MailScanner too, I use it with postfix and dovecot and all my user accounts are virtual (stored in MySQL)

I presume your current configuration is working, right ? What you need is a sieve modul for dovecot

Mail filtering is done by dovecot's deliver + sieve, that's why you have to set up your postfix to use dovecot's deliver for mail delivery and set up your dovecot to use sieve plugin.

Here are the most important parts of my configuration:

Postfix

master.cf


--- Code: ---# ...
dovecot  unix -   n    n   -   -   pipe
 flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}
# ...
--- End code ---

main.cf


--- Code: ---# ...
virtual_transport=dovecot
dovecot_destination_recipient_limit=1
# ...
--- End code ---

MailScanner

MailScanner.conf


--- Code: ---# ...
%org-name% = MYORG
Required SpamAssassin Score = 5
High SpamAssassin Score = 10
Spam Score = yes
Spam Actions = deliver header "X-MYORG-Spam-Flag: Yes"
High Scoring Spam Actions = delete
# ...
--- End code ---

Dovecot


--- Code: ---# ...
protocol lda {
 mail_plugins = cmusieve
 global_script_path = /var/spool/vmail/globalsieverc
 log_path = /var/log/dovecot/deliver.log
 info_log_path = /var/log/dovecot/deliver.log
 # ...
}
auth default {
 socket listen {
   master {
    path = /var/run/dovecot/auth-master
    mode = 0660
    user = vmail
    group = vmail
 }
 # ...
}
# ...

--- End code ---

/var/spool/vmail/globalsieverc


--- Code: ---require ["fileinto"];

# ...

#
# Move SPAM to Junk
#

if anyof (
    header :contains ["X-MYORG-MailScanner-SpamScore"] "sssss",
    header :contains ["X-MYORG-Spam-Flag"] "Yes"
) {
    fileinto "Junk"; stop;
}
--- End code ---

Don't forget to doublecheck right permissions to all config files and directories.

Eleventeen:
Wow, thanks for that! I knew it must be possible, but I haven't had much experience with webmail clients since using Squirelmail a few years ago and always found Thunderbird's filtering to work fine so I never gave any thought to serverside filtering. :P

The problem is that I'm running cPanel, with courier-imap and exim. They don't support Dovecot *yet* (although I've read some great things about it, and would switch in a second if they started supporting it. Is it at all possible to filter email using those servers?

thanks again for your help! :)

timelord:
Sure, as I know, exim has a sieve plugin, so what you need is just set up filter rules for exim's sieve.

Eleventeen:
Odd, I added a .forward file to my home directory and added the rules you suggested, exim doesn't seem to be picking them up. Do I need to install something to use sieve, or do I need to change anything in exim to make it detect .forward files? Thanks again!

Navigation

[0] Message Index

[#] Next page

Go to full version