Script to see what your users are training for spam and ham
Posted: Sat Dec 08, 2018 12:30 am
If you are curious to see how your spam rules are working with your users, this little bash script pulls their training emails.
It will pull both the spam and ham emails provided there is email to be pulled. It is not destructive and only makes a copy so will not affect how zmtrainsa works.
It can be found here: https://github.com/JimDunphy/ZimbraScri ... mcopyTrain
Extra credit:
Look inside email.out to see why and what rules fired. Adjust your sauser.cf rules and scores and repeat running the email through until the system scores it as spam or ham.
Background Information:
If a user hits the junk button, that email is sent to a special spam user.
If you drag a message to the junk folder, it is sent to a special spam user.
If you move a message into a junk folder via a filter and action, it is sent to a special spam user.
Same is true for the ham case.
This script pulls those emails from both the ham and spam account so the admin can look at why the email wasn't properly classified.
Code: Select all
# su - zimbra
% zmcopyTrain
Pulling spamassassin data.
[] INFO: Total messages processed: 15
[] INFO: Total messages processed: 0
See /tmp/zmtrainsa.25864.spam.WA41r5 for spam
[zimbra@relay3 ~]$ ls /tmp/zmtrainsa.25864.spam.WA41r5
1678b15bf37-0 1678b15bf37-10 1678b15bf37-12 1678b15bf37-14 1678b15bf37-3 1678b15bf37-5 1678b15bf37-7 1678b15bf37-9
1678b15bf37-1 1678b15bf37-11 1678b15bf37-13 1678b15bf37-2 1678b15bf37-4 1678b15bf37-6 1678b15bf37-8
It can be found here: https://github.com/JimDunphy/ZimbraScri ... mcopyTrain
Extra credit:
Code: Select all
# su - zimbra
% cd /tmp/zmtrainsa.25864.spam.WA41r5
% spamassassin -D < 1678b15bf37-0 > /dev/null 2> email.out
Background Information:
If a user hits the junk button, that email is sent to a special spam user.
If you drag a message to the junk folder, it is sent to a special spam user.
If you move a message into a junk folder via a filter and action, it is sent to a special spam user.
Same is true for the ham case.
This script pulls those emails from both the ham and spam account so the admin can look at why the email wasn't properly classified.