sa_userconf_maps and sa_username_maps syntax question

Matt Goodman matt at
Thu Sep 8 20:47:19 CEST 2011

Ah thanks, I am reviewing the release-notes now. 

However, what I am reading is that the example listed for @sa_username_maps
statically maps usernames which is a smaller scale than I am trying to
implement. With a larger scale system, how do I tell @sa_username_maps to
pass the email address supplied from the RCPT TO as the SA username? 

Or is that what the earlier reference to the following will do (provided by
Florin Portase on 09/01/2011):

@sa_username_maps = new_RE (
  [ qr'^([^@]+ at .*)'i => '${1}' ]

And finally, will I need to have @sa_userconf_maps set to "sql:" if I only
wish to do per-user bayes? Would this potentially cause any other problems
if we enable this setting but do not use any per-user preferences?

For reference:

All my users will have their own custom bayes without exception. We do not
wish to use per-domain or per-policy-bank bayes, per-user only. My SA/bayes
SQL configuration is sound and currently working - however, only one bayes
database is in the table, and it is owned by user 'amavis'.

-----Original Message-----
From: at
[ at] On Behalf Of Mark
Sent: Thursday, September 08, 2011 7:50 AM
To: amavis-users at
Subject: Re: sa_userconf_maps and sa_username_maps syntax question


> I examined the patch file that was presented and I have to go a 
> different direction. Since required_score is somewhat handled already 
> via the policy system (although users cannot specify their own 'score' 
> they can indeed change policies, which in turn affects score), I think 
> I'm going to focus on per-user Bayes.

Makes sense, per-user Bayes is much more efficient than per-user
SpamAssassin preferences/config.

> What part of amavisd-new goes and checks per-user bayes? I see nothing 
> in earlier examples nor in the patch which address having amavisd-new 
> handle per-user Bayes classification.

There is a 80+ line description of @sa_username_maps and @sa_userconf_maps
with examples in the 2.7.0 release notes.

Search for sections starting with:
  - per-recipient (or per- policy bank, or global) SpamAssassin
configuration and
  - per-recipient (or per- policy bank) SpamAssassin SQL database usernames

> Or is that solely done through SA's configuration?

Before a call to SpamAssassin, amavisd tells SpamAssassin which username to
use. The rest (SQL lookup etc.) is done by SpamAssassin.

> If no changes are required in amavisd-new to get per-user Bayes 
> working, then I apologize.

No changes should be necessary, apart from configuring @sa_username_maps in

> I can get SA's /etc/spamassassin/ to use the per-user Bayes. 
> I'm just new to amavis and assume that amavis has to handle checking 
> against the per-user Bayes database. Is this correct?

When per-recipient bayes is needed, amavisd calls SpamAssassin possibly
multiple times for multiple recipients of a message, once for each unique
username. Before the call the username is passed to SpamAssassin, the rest
is SpamAssassin's task.


More information about the amavis-users mailing list