Per user SA-Bayes tokens in SQL

Mark Martinec Mark.Martinec+amavis at
Thu Aug 30 18:57:58 CEST 2012


> is there a way to configure per-user Bayes tokens for SA?

Since amavisd-new-2.7.0.

Note that this implies that for a multi-recipient message
SpamAssassin will need to be called more than once per message.

> In my bayes config I've removed the bayes_sql_override_username. Initial
> training when mail is scanned by Amavis/SpamAssassin still seems to
> store the tokens as the amavis-user rather than the recipient.
> Re-training is done with a custom script that configures the user
> (sa-learn -u). Is it possible to configure Amavis so it passes the
> recipient to SpamAssassin so it can store per-user Bayes information?

amavisd-new-2.7.0 release notes:

- per-recipient (or per- policy bank) SpamAssassin SQL database usernames
  are supported (setting @sa_username_maps, a policy.sa_username SQL field).
  This makes it possible to implement per-user or per-user-group or
  per-domain Bayes databases when SpamAssassin is configured to keep
  its Bayes database on an SQL server. It also makes it possible to load
  per-recipient SpamAssassin preferences (configurations) from an SQL
  database (as described in a previous section).

  Switching between Bayes usernames is cheap compared to switching between
  SpamAssassin configuration files.  A multi-recipient message whose
  recipients map to different usernames will be checked by SpamAssassin
  multiple times, once for each unique username;

    @sa_username_maps = (
      { 'user1 at' => 'user1',
        'user2 at' => 'user2',
        ''      => 'user_ex',


More information about the amavis-users mailing list