On Mar 3, 2015, at 8:55 AM, Noel Jones <njo...@megan.vbhcs.org> wrote:
> On 3/3/2015 9:47 AM, LuKreme wrote:
>> On Mar 3, 2015, at 08:30, Noel Jones <njo...@megan.vbhcs.org> wrote:
>>> 
>>> To manually test a message, use something like:
>>> postcat -bhq QUEUEID | spamassassin
>> 
>> I was surprised that postcat requires a full path to the file, but thanks 
>> for the info in the "From " header.
> 
> If you use the postcat -q option, you don't need the full path.
> man 1 postcat

This is what I have to clear the held message and send them to sa-learn, in 
case it’s useful to anyone else.

$ cat /usr/local/bin/spamd-learn
#!/bin/bash

SUSER="spamd"
SPAMF="${SUSER}/trained/spam”

# search for held messages, get qid, train as spam, and save message, then 
remove from queue.

MYIDS=`mailq | tail -n +2 | grep -v '^ *(' | awk '{print $1}' |grep "!" | tr -d 
'!'`
if [[ !$MYIDS ]]; then
  for i in ${MYIDS}; do
    postcat -bhq $i | sudo -u ${SUSER} sa-learn --spam
    postcat -bhq $i > ${SPAMF}/$i
    postsuper -d $i
  done
fi

#EOF

Obviously, this should only be run after looking at the messages in the mailq 
to make sure they are spam.

-- 
"How good bad music and bad reasons sound when we march against an
enemy." -  Friedrich Nietzsche

Reply via email to