RelayCountry - add message metadata indicating the country code of each relay


  loadplugin     Mail::SpamAssassin::Plugin::RelayCountry


The RelayCountry plugin attempts to determine the domain country codes of each relay used in the delivery path of messages and add that information to the message metadata.

Following metadata headers and tags are added:

 X-Relay-Countries           _RELAYCOUNTRY_
   All untrusted relays. Contains all relays starting from the
   trusted_networks border. This method has been used by default since
   early SA versions.

 X-Relay-Countries-External  _RELAYCOUNTRYEXT_
   All external relays. Contains all relays starting from the
   internal_networks border. Could be useful in some cases when
   trusted/msa_networks extend beyond the internal border and those
   need to be checked too.

 X-Relay-Countries-All       _RELAYCOUNTRYALL_
   All possible relays (internal + external).

 X-Relay-Countries-Auth      _RELAYCOUNTRYAUTH_
   Auth will contain all relays starting from the first relay that used
   authentication. For example, this could be used to check for hacked
   local users coming in from unexpected countries. If there are no
   authenticated relays, this will be empty.


This plugin requires the GeoIP2, Geo::IP, IP::Country::DB_File or IP::Country::Fast module from CPAN. For backward compatibility IP::Country::Fast is used as fallback if no db_type is specified in the config file.


The following options can be used in both site-wide ( and user-specific (user_prefs) configuration files to customize how SpamAssassin handles incoming email messages.

country_db_type STRING

This option tells SpamAssassin which type of Geo database to use. Valid database types are GeoIP, GeoIP2, DB_File and Fast.

country_db_path STRING

This option tells SpamAssassin where to find MaxMind GeoIP2 or IP::Country::DB_File database.

If not defined, GeoIP2 default search includes: /usr/local/share/GeoIP/GeoIP2-Country.mmdb /usr/share/GeoIP/GeoIP2-Country.mmdb /var/lib/GeoIP/GeoIP2-Country.mmdb /usr/local/share/GeoIP/GeoLite2-Country.mmdb /usr/share/GeoIP/GeoLite2-Country.mmdb /var/lib/GeoIP/GeoLite2-Country.mmdb (and same paths again for -City.mmdb, which also has country functionality)