<<< Date Index >>>     <<< Thread Index >>>

Re: faster spamassassin macro?



On 2003-10-10, Allister MacLeod <amacleod@xxxxxxxx> wrote:
>
> --SUOF0GtieIMvvwua
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
>
> On Fri, Oct 10, 2003 at 12:18:40AM +0200, Joel Aufrecht wrote:
>
>> There are two problems.  First, even if I put two ^ms in the macro, I
>> still have to manually hit return at the "Press any key to
>> continue..." prompt to exit the shell.  So it's a two-step process
>> instead of one-step.  Second, the whole thing takes a few seconds, so
>> it's annoying to tag spam in my inbox.  Is there some way to spin this
>> off in the background so that it doesn't interrupt mail reading?  Or,
>> second-best, a way to batch-process a bunch of tagged messages through
>> spam-assassin and then delete them?

Here's what I do. I'm really happy with this solution.

I have key bindings that remaps "Delete" to move mail to a trash folder,
and another one for "Delete as Spam" which moves the mail to a spam
folder.

A cron script runs nightly to learn from both folders. It then  "empties the 
trash"
of normal mail, but /does not/ delete anything from the spam folder, 
because I want to review that by hand to avoid the possibility of
a real message in the spam folder accidentally getting deleted.

I use a mutt folder hook on the spam folder. It automatically 
marks all the spam that has already been processed as deleted.
This makes deleting appropriate mail from this folder as easy as
possible. I just open the spam folder, scan through it and close it.
Mutt will then confirm that it is deleting messages from it. 

Here are the relevant parts of my .muttrc:

#######
# SpamAssassin integration

# Delete is re-bound to move messages to Trash. They will be filed as ham by a 
cron script later.
macro index d "s=Trash\n" "move message to trash"
macro pager d "s=Trash\n" "move message to trash"

# Spam that SA missed is manually sent to the junkmail folder
macro index X "s=junkmail\n" "file as Spam"
macro pager X "s=junkmail\n" "file as Spam"

# Junk/spam mail older than two days is automatically marked for deletion 
# because it will have already been processed as spam by a cron script
folder-hook             "=junkmail" 'push <delete-pattern>"~d>2d"\n'


##################
# Here's my cron script:

#!/bin/sh

TRASH=$HOME/mail/Trash
SPAMBOX=$HOME/mail/junkmail

[ -w $HAMBOX ] || exit 1
[ -w $SPAMBOX ] || exit 1

# process Trash as ham
if sa-learn --mbox --ham $TRASH
then
  # delete Trash
  cat /dev/null > $TRASH
fi

# process Spam, don't delete-- I'll review it by hand later
sa-learn --mbox --spam $SPAMBOX




--
http://mark.stosberg.com/