CLI zmtrainsa

Revision as of 18:38, 10 March 2008 by Cfremon (talk | contribs) (Creating heading levels for Version Specific Notes, adding note for 5.0.2, adding Template:Article Footer)


This command is used to train the anti-spam filter; it is run automatically every night (on the & accounts) to train the SpamAssasin filter from messages users mark as “junk” or “not junk” from their mailbox. See Zimbra_MTA#Anti-Spam_Training_Filters for a longer description

You need at least 200 spam & 200 not-spam to enable the bayes filter.

You can use this command to manually send one account’s mail through the spam filter.


zmtrainsa <server> <user> <spam|ham> [folder]

Description & Notes

-Fetches the mail from <user> from <server> and trains the filter as either spam or ham <spam|ham>.

-If a folder is not defined, the contents of the Inbox is fetched.

-Server name may be required if in a multi-server install.

Version Specific Notes


zmtrainsa has no server argument in 5.0.2.


As of 4.5.6 the user's password is no longer needed:

 su zimbra
 /opt/zimbra/bin/zmtrainsa spam|ham folderName

(I do not remember if 4.5.5 actually got the no password required RFE before it was verified in 4.5.6 but it was relatively easy because zmspamextract (which used by zmtrainsa) already supported extracting messages from users' folders with admin auth credentials.

Prior to 4.5.4

Prior to 4.5.4: zmtrainsa <server> <user> <pass> <spam|ham>

Verified Against: ZCS 4.5.x, 5.0.x Date Created: 4/3/2006
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