

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
2 messages in net.sourceforge.lists.courier-sqwebmailRe: [sqwebmail] sqwebmail and bogofilter| From | Sent On | Attachments |
|---|---|---|
| Bambero | Feb 11, 2006 6:33 am | |
| Mark Constable | Feb 11, 2006 2:13 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [sqwebmail] sqwebmail and bogofilter | Actions... |
|---|---|---|
| From: | Mark Constable (mar...@renta.net) | |
| Date: | Feb 11, 2006 2:13:41 pm | |
| List: | net.sourceforge.lists.courier-sqwebmail | |
On Sunday 12 February 2006 00:33, Bambero wrote:
Sqwebmail is great product but there is no spam filtering functionality (except mail filtering).
What server side filtering gets used depends more on the delivery agent for the mail server handling the incoming messages.
Bogofilter is great solution for filtering spam messages. It allows users to decide which is spam, which is ham.
It will be nice to use bogofilter in sqwebmail (for ex. by clicking mark as spam). This functionality is available in gmail and it works great.
That would require locking in sqwebmail to perhaps using only bogofilter (or a particular filtering engine) and require significant changes to sqwebmail.
Maybe there is a patch (or other solution) which includes bogofilter to sqwebmail.
My method depends on using maildrop (comes with courier-mta), a couple of "special" folders for retraining and a cron job to run a shell script that does the retraining. If Sam dropped the 'to "$HOME/Maildir/."' at the end of the auto created .mailfilter then I could offer sqwebmail generated filters BEFORE (override) any other filters as well.
First, I make the default delivery agent maildrop..
./courierd:DEFAULTDELIVERY="| /usr/bin/maildrop"
so any user without a .courier file will go through the global /etc/courier/maildroprc first. Adding a standard .courier file with ./Maildir disables bogofiltering.
Second, create 4 extra folders. They could be called anything but I use..
maildirmake $HOME/Maildir/.Spam maildirmake $HOME/Maildir/.Spam.ThisIsSpam maildirmake $HOME/Maildir/.Spam.ThisIsNotSpam maildirmake $HOME/Maildir/.Spam.Suspect
Third, use a global maildroprc, or users ~/.mailfilter, file to run messages through bogofilter and place them into either the Spam folder for spam, Inbox for ham or Suspect for unsure.
Fourth, users are instructed to drag incorrectly tagged ham or spam from the above 3 folders into either the ThisIsSpam or ThisIsNotSpam "special" retraining folders.
Fifth, a cron job every hour looks at those 2 folders and runs them back through bogofilter for retraining then puts any messages from ThisIsNotSpam back into the Inbox and deletes them from ThisIsSpam, after retraining.
The maildroprc is something like this and the cron update below that...
xfilter "/usr/bin/bogofilter -l -u -e -p -d $HOME/Maildir" if ((/^X-Bogosity: Spam/:h)) { to $HOME/Maildir/.Spam } if ((/^X-Bogosity: Unsure/:h)) { to $HOME/Maildir/.Spam.Suspect }
Any message that survives the above 2 rules goes into Inbox.
Get a list of users and work out the full path to their Maildir and call it MPATH (in my case). Working out the user uid/gid might be tricky when mv'ing the hams back to the users Inbox but all my users are virtual and share the same uid/gid as the mail server so I run this script as that user and don't have any permission problems.
for p in $MPATH/.Spam.{ThisIsSpam/cur,ThisIsSpam/new}; do if [ -d $p ]; then cd $p for f in $(/bin/ls -1); do /usr/bin/bogofilter -l -d$MPATH -Ns < "$f" /bin/rm $f done fi done
for p in $MPATH/.Spam.{ThisIsNotSpam/cur,ThisIsNotSpam/new}; do if [ -d $p ];then cd $p for f in $(/bin/ls -1); do /usr/bin/bogofilter -l -d$MPATH -Sn < "$f" /bin/mv $f $MPATH/cur done fi done
And there we have effective IMAP based without having to change the sqwebmail code at all... well, as mentioned, if the default "to" directive was removed from autocreated .mailfilters (from sqwebmail) then user generated filters could also work in with this scheme and even override the maildroprc default behavior.
--markc







