How Not to be a open Relay using the Mercury mail server, by Iain Moffat,UF 
How to close relay on Mercuryby MAPS TSI
Download the latest version of Mercury

Mercury versions prior to 1.40 do not have provisions to prevent unauthorized relay. If you are running a earlier version, pleaseupgrade.
To disable relaying, the following text should be added to the [MercuryS] section of the mercury.ini file.  “Relay: 0” signifies normal relay mode where mail will be accepted for relaying if the originator’s address is local.

Relay : 0

For stricter relaying, add the following text to the mercury.ini file.  In strict mode, if the originator’s address is local, Mercury additionally checks to see that the IP address of the SMTP client making the relay request is covered by an explicit “Allow” entry in the [MercuryS] section fo the mercury.ini file.

Relay : 0
Strict_Relay : 1
Allow : # The offsite backup (MX server)
Allow : 128.227.XXX.0   # Our local network
Allow : 128.227.YYY.5   # A single other machine we allow