GeoWeight

Tested: 2+ weeks live, test

Description^

Geo weighting helps to tailor your spam fighting to your local needs. In most cases, you will receive mostly mail from certain regions. However, you have to “know” your valid recipients if you want to use this module. This module can score based on country codes (two letter, ISO 3166-1-alpha-2) and/or store statistics about sources of your mail traffic. If you plan to use this module, you should run the statistics only for some time, until you have a good overview of where your senders live.

This module is based on the geo-ip library which is based on the geo lite database.

Configuration^

enable_stats^

Default: 0
Allowed Values: bool (0 or 1)

Whether stats are enabled or not. You can either dump the stats via the server.pl program using –print-stats or looking directly in the database. The stats will be created per country and per interval. The intervals are hard coded:

  • total
    Over all time
  • Y-m-d
    Per day, eg 2010-06-21
  • Y-m
    Per month, eg 2010-06
  • Y
    Per year, eg 2010

disable_weight^

Default: 0
Allowed Values: bool (0 or 1)

If you wan’t to disable weightings (eg while collecting stats to figure out where the senders come from).

weight_class^

Default: -
Allowed Values: complex ArrayRef of HashRef (eg [ {countries: [ 'DE', 'US' ], weight: 5 } ])

Expexts ArrayRef of HashRefs of:

countries

ArrayRef of two letter country codes.

weight

Integer value for weighting. Can be positive or negative.

weight_default^

Default: 0
Allowed Values: Integer (probably negative)

Default weighting for countries not in the weighting classes. You can either put all “dubious” countries in the weight_class and then score anything per default with 0 or higher or vice versa: put any “good” country in the weight_class and score anything else below zero.

Example^

---

disable: 0

enable_stats: 1

disable_weight: 0

weight_classes:
    -
        countries:
            - DE
            - US
            - AU
        weight: 10
    -
        countries:
            - SE
            - DK
        weight: 5

weight_default: -5

Database^

Used for stats.

-- TABLE: geo_stats (SQLITE):
CREATE TABLE GEO_STATS (country varchar(2), counter integer, interval varchar(25), id INTEGER PRIMARY KEY);
CREATE UNIQUE INDEX GEO_STATS_COUNTRY_INTERVAL ON GEO_STATS (country, interval);

Performance^

Runtime: average (2 countries) 0.01 secs

Leave a Reply

CAPTCHA image