IMAP and Outlook Spam training

Revision as of 18:16, 10 March 2008 by Cfremon (talk | contribs) (Adding Template:Unsupported, Template:Article Footer, and Category:Anti-spam)

IMAP/Outlook move to junk doesn't train anti-spam - It seems that when you move a mail to junk folder on IMAP client (like Thunderbird) anti-spam filter on MTA does not use that mail as a spam example for training... See

Here is a bash script created from the comments against this bug. I have tested it on our system and it appears to work OK. Feel free to contribute and enhance! Full credit for this script is due to and who wrote the bits which I just pasted together!


wikiuser=`zmprov getConfig zimbraNotebookAccount | cut -d ' ' -f 2`;
hamuser=`zmprov getConfig zimbraSpamIsNotSpamAccount | cut -d ' ' -f 2`;
spamuser=`zmprov getConfig zimbraSpamIsSpamAccount | cut -d ' ' -f 2`;

users=`zmprov getAllAccounts | grep -v -e $wikiuser -e $hamuser -e $spamuser`;

for zuser in $users
echo "Train spam for $zuser"
/opt/zimbra/bin/zmtrainsa $zuser spam junk

echo "Zimbra spam training complete"

To install, save the above script as '', copy to /opt/zimbra/ on your Zimbra server. Set ownership and make executable:

[root@mail ~]# chmod +x /opt/zimbra/
[root@mail ~]# chown zimbra:zimbra /opt/zimbra/

And then create this crontab entry, /etc/crontab

#Learn more spam 6am daily
0 6 * * * zimbra /opt/zimbra/ > /dev/null 2>&1

That should be it :)

Verified Against: unknown Date Created: 3/5/2008
Article ID: Date Modified: 2008-03-10

Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search