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! :)
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
# ...
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}
# ...
main.cf
# ...
virtual_transport=dovecot
dovecot_destination_recipient_limit=1
# ...
MailScanner
MailScanner.conf
# ...
%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
# ...
Dovecot
# ...
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
}
# ...
}
# ...
/var/spool/vmail/globalsieverc
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;
}
Don't forget to doublecheck right permissions to all config files and directories.
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! :)
Sure, as I know, exim has a sieve plugin, so what you need is just set up filter rules for exim's sieve.
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!
I'm sorry, I haven't too much knowledge about Exim, I prefer Postfix.
But try this: www.exim.org+inurl:exim-html-current&ie=utf-8&oe=utf-8]Sieve (http://www.google.com/search?rls=en&q=Sieve+site:%5Burl) site:www.exim.org[/url]. There is some good information that can help.
I think it's a cPanel related issue, because of the stock exim configuration they provide... I read through that document three times and even looked for some how-to's on using sieve filters with Exim but had no luck. Odd. It's like exim isn't even looking for the .forward file I'm writing. Hopefully some of the pro's at the cPanel forums can give some info about this. ;)
Thanks a lot for your help! If I ever get this working I'll post back with the solution. :)
Eleventeen,
I use SpamAssassin to filter my spam. Unfortunately, it only appends *****SPAM***** to the subject and keeps the mail in the inbox. I'm not sure exactly how your setup is but if you can make it add something to the subject I wrote a quick roundcube patch today. Basically, it searches for a string in the subject line and if it's present it automatically moves that mail to the junk folder. Here's a link to the forum post:
http://roundcubeforum.net/forum/index.php?topic=2205.0
And to the page with the patch download:
http://fusionreactions.com/pages/rcmail
Let me know if you need anything specific relating to your setup and maybe I can help you out.
Enjoy,
Steve Corona
Steve,
many of the installations of SA put
X-Spam-Flag: YES
in the header. if you need some other info, or a place to test, or whatever, let me know.
thanks
pat.