Use this script.
In the aliases file put entry like this:
spam: spam@spam.spam
nospam: nospam@ham.ham
Then in transport file specify a transport for these:
spam.spam sa-spam:
Then in the master.cf make the following addition (this will feed the
coming mail incoming mail as input to the sa-wrapper.pl )
ham.ham sa-ham:
sa-spam unix - n n - - pipe
user=mail:mail argv=/usr/local/bin/sa-wrapper.pl spam ${sender}
sa-ham unix - n n - - pipe
user=mail:mail argv=/usr/local/bin/sa-wrapper.pl ham ${sender}
Then for mutt:
macro index S ":set autoedit=no fast_reply=yes editor='/bin/true'\n
macro index H ":set autoedit=no fast_reply=yes editor='/bin/true'\n