---
title: RelayCountry
url: 'https://docs.danami.com/warden/user-guide/antispam-plugins/relaycountry'
markdown: 'https://docs.danami.com/warden/user-guide/antispam-plugins/relaycountry.md'
date: '2026-10-01'
description: 'This plugin requires the Perl Module GeoIP2::Database::Reader. 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 as the "X-Relay-Countries" header, or the _RELAYCOUNTR…'
taxonomy:
  category:
    - docs
  tag:
    - relaycountry
---

[](#)  [ Basics ](https://docs.danami.com/warden/)     [ User Guide ](https://docs.danami.com/warden/user-guide)     [ Anti-spam Plugins ](https://docs.danami.com/warden/user-guide/antispam-plugins)      RelayCountry    

# RelayCountry

> > > > > This plugin requires the Perl Module [GeoIP2::Database::Reader](https://docs.danami.com/warden/settings/antispam/plugin-settings#geoip2-database-reader-perl-module-installation).

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 as the "X-Relay-Countries" header, or the `_RELAYCOUNTRY_` markup. This will add country-based metadata to the Bayesian filtering process, allowing the Bayesian filters to learn information based on countries. Private IPs are marked with `**` (two asterisks) and IPs not found in the database are marked with `XX`.

## How it works

For each relay in the message's `Received:` chain, the plugin looks up the relay's country code in the GeoIP database and records the results in the `X-Relay-Countries` header / `_RELAYCOUNTRY_` markup. If a message is relayed through any of the countries listed in `relaycountry_bad_countries`, the `RELAYCOUNTRY_BAD` rule fires (scored with `relaycountry_bad_score`); if it is relayed through any of the countries in `relaycountry_good_countries`, the `RELAYCOUNTRY_GOOD` rule fires (scored with `relaycountry_good_score`).

## Headers

- `_RELAYCOUNTRY_` - All untrusted relays, starting from the `trusted_networks` border.
- `_RELAYCOUNTRYEXT_` - All external relays, starting from the `internal_networks` border.
- `_RELAYCOUNTRYALL_` - All possible relays (internal + external).
- `_RELAYCOUNTRYAUTH_` - All relays starting from the first relay that used authentication.

## Rules

| Area | Rule name | Description | Default scores |
|---|---|---|---|
| header | `RELAYCOUNTRY_BAD` | relay server in the list of bad countries | 3.25 |
| header | `RELAYCOUNTRY_GOOD` | relay server in the list of good countries | -0.5 |

## Related Pages

- [RelayCountry Settings](https://docs.danami.com/warden/settings/antispam/plugin-settings/relaycountry "RelayCountry Settings")

 [](https://docs.danami.com/warden/command-line-interface/antispam/antispam-plugin-relaycountry)

---

## Navigation

- Parent: [Anti-spam Plugins](https://docs.danami.com/warden/user-guide/antispam-plugins.md)
- Previous: [Redirectors](https://docs.danami.com/warden/user-guide/antispam-plugins/redirectors.md)
- Next: [Rule2XSBody](https://docs.danami.com/warden/user-guide/antispam-plugins/rule2xsbody.md)
