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

Re: Running a shell command while saving messages to mailboxes



On 2004-12-16 11:24 +0100, Sebastien.Hinderer@xxxxxxxxxxxxxx wrote:
> The aim is to feed spamassassin automatically with all ham messages as
> soon as they are saved to a milbox which is not =spam.
> This would avoid having to call sa-learn regularly on several mailboxes,
> which is anyway something non-trivial (atleast for me) as soon as
> mailboxes ar stored in maildir format.

I'm not entirely up to speed on maildir, so the "cur" may be wrong,
but what about a cron job doing something like this? (Assuming bash.)

        for msg in mailbox/cur/*
        do
          cat mailbox/cur/${msg} | sa-larn --ham
        done

This could be run often, even every few minutes if you like, and the 
"mailbox" part could even be a separate loop, like so:

        for mailbox in mb1 mb2 mb3 ...
        do
          for msg ...
          do
            cat ...
          done
        done

That would seem to me at least to do the trick. I'm sure if you want
to get really fancy you could even write something to parse your mutt
configuration files and extract a list of mailboxes from there.

-- 
Michael Kjörling, michael@xxxxxxxxxxxx - http://michael.kjorling.com/
* ASCII Ribbon Campaign: Against HTML Mail, Proprietary Attachments *
* No bird soars too high if he soars with his own wings. -*- SM0YBY *