Mon, 17 May 2010

Marking spam in mutt with spamassasin


Keywords: mutt spam spamassasin macro

For far too long I had fairly simple macros for mutt which would train spamassasin on a single message and then chuck it in my spam folder. It worked well, but only on single messages. I wanted something that would also work on a set of tagged messages in a reasonable time. Eventually I got around to working out how to do it.

Mutt has the limitation that for the pager the macro will not work on tagged messages, but I kept the macros the same as for the index for simplicity.

Here they are:

macro index S "<enter-command>set auto_tag=yes<enter><enter-command>unset wait_key<enter>WoC=learnspam<enter>\
<pipe-entry>sa-learn --spam --progress --mbox ~/Mail/learnspam && cat /dev/null > ~/Mail/learnspam<enter>\
s=spam<enter><enter-command>set wait_key<enter><enter-command>set auto_tag=no<enter>"

macro pager S "<enter-command>set auto_tag=yes<enter><enter-command>unset wait_key<enter>WoC=learnspam<enter><\
pipe-entry>sa-learn --spam --progress --mbox ~/Mail/learnspam && cat /dev/null > ~/Mail/learnspam<enter>\
s=spam<enter><enter-command>set wait_key<enter><enter-command>set auto_tag=no<enter>"

macro index H "<enter-command>set auto_tag=yes<enter><enter-command>unset wait_key<enter>C=learnspam<enter>\
<pipe-entry>sa-learn --ham --progress --mbox ~/Mail/learnspam && cat /dev/null > ~/Mail/learnspam<enter>\
s=spam<enter><enter-command>set wait_key<enter><enter-command>set auto_tag=no<enter>"

macro pager H "<enter-command>set auto_tag=yes<enter><enter-command>unset wait_key<enter>C=learnspam<enter>\
<pipe-entry>sa-learn --ham --progress --mbox ~/Mail/learnspam && cat /dev/null > ~/Mail/learnspam<enter>\
s=spam<enter><enter-command>set wait_key<enter><enter-command>set auto_tag=no<enter>"

[/software/mutt] permanent link




November 2022
Sun Mon Tue Wed Thu Fri Sat