Mark Martinec Mark.Martinec+amavis at ijs.si
Mon Jul 16 14:15:27 CEST 2012


> I am configuring Amavis to look the configuration up in a sql database
> and have some questions. Hopefully someone can help me to fix the
> following things:
> 1. It seems, that spam_tag3_level and the corresponding subject field
> are not looked up from the sql db. Only the local _maps are read.
> I could fix this by editing amavisd_new  and inserting the unshift
> ...spam_tag3_level... etc  for the missing fields
> But I would like to get this running without editing the code!
> So How could I put the values that where called from the db  into the
> right _maps?

The spam_tag3_level and spam_subject_tag3 SQL fields were added in
amavisd-new-2.7.0, but are not looked up in SQL in 2.6.6 and older.

Either upgrade to 2.7.2 or 2.8.0, or you will need to
add the unshift to the code in 2.6.6, as you suggested.

> On this list I read some answers from Mark, who talked about
> lookup_sql_field -> but I have no idea how to get
> lookup_sql_field(fieldname) to work in my amavis conf file.

Not sure what you have in mind. The lookup_sql_field is an
internal function implementing an SQL lookup.

Perhaps you are referring to q_sql_s, q_sql_n, and q_sql_b,
which can achieve an equivalent of the mentioned 'unshift',
but from a config file. These were added in 2.7.0, described
in release notes.

> Can anybody just give me the example code for the tag3 fields, so they
> are available to amavis?
> To keep full compatibility to other systems or updates I really do not
> want to touch the code of amavis even if this seems to be the easyest
> way to fix this.
> So any way to request the custom sql fields for some missing vars  would
> be very helpful.

Upgrade to 2.7.2 or 2.8.0 .

> 2. Same for some other values as the
> $sa_spam_report_header = 1; # insert X-Spam-Report header field?
> How could I fill this var with my result from the sql field spam_report ??

The $sa_spam_report_header is not configurable per-recipient,
and as such there is no corresponding @*_maps list, and no
way to look it up, neither in SQL, nor in statical lookups.

Moreover, the $sa_spam_report_header has been obsoleted
in 2.7.0, and its replacement %allowed_added_header_fields
similarly does not provide per-recipient configurability.

Btw, the %allowed_added_header_fields is a dynamic setting,
i.e. a member of policy banks, and as such can be changed
by loading a policy bank (like on a sender origin, port number
or other characteristics of a message as a whole, but not
as a by-recipient setting, as a message can have multiple

2.7.0 release motes:

- retired a setting $sa_spam_report_header, it was obsoleted in
   amavisd-new-2.4.3 with the introduction of %allowed_added_header_fields.
   To enable insertion of X-Spam-Report header field, please use instead:
     $allowed_added_header_fields{lc('X-Spam-Report')} = 1;
   The variable is still declared for compatibility with old config files,
   but its value is ignored. An attempt to set its value to a non-default
   value produces a warning.


More information about the amavis-users mailing list