You can manually train SpamAssassin to work with all mail accounts on the server from the command line using the sa-learn utility that is a part of SpamAssassin.

To train SpamAssassin to work with all mail names on the server:

  1. Prepare samples of spam and ham (non-spam) messages. The recommended number is several thousand of each.

  2. Store spam and ham messages in two different folders for each mailbox.

  3. Train SpamAssassin to work with one mailbox using the messages from these folders:

    # sa-learn --spam </path/to/spam/folder>
    # sa-learn --ham </path/to/ham/folder>

    where </path/to/spam/folder> and </path/to/ham/folder> should be replaced by the paths to the folders with spam and ham messages of the corresponding mailbox.

  4. Repeat this command for every mailbox on the server.

Find more information about using the sa-learn utility in the SpamAssassin documentation.