Next: Checking Sender Address, Previous: Functions and Modules, Up: Tutorial [Contents][Index]
Site administrators often do not wish to accept mail from hosts that
do not have a proper reverse delegation in the Domain Name System.
In the previous section we introduced the library function
hostname
, that looks up in the DNS the name corresponding to
the IP address specified as its argument. If there is no
corresponding name, the function returns its argument unchanged. This
can be used to test if the IP was resolved, as illustrated in the
example below:
require 'dns' prog envfrom do if hostname($client_addr) = $client_addr reject fi done
The #require dns
statement loads the module dns.mfl,
after which the definition of hostname
becomes available.
A similar function, resolve
, which resolves the symbolic
name to the corresponding IP address is provided in the same
dns.mfl module.