4.12.1.27 Special Test Functions

Built-in Function: boolean listens (string host, [number port])

Returns true if the IP address or host name given by host argument listens on the port number port (default 25).

Built-in Function: boolean validuser (string name)

Returns true if authenticity of the user name is confirmed using mailutils authentication system. See section Local Account Verification, for more details.

Library Function: boolean valid_domain (string domain)

Returns true if the domain name domain has a corresponding A record or if it has any ‘MX’ records, i.e. if it is possible to send mail to it.

To use this function, require ‘valid_domain.mf’ module (see section Modules):

 
require valid_domain

Library Function: number heloarg_test (string arg,   string remote_ip, string local_ip)

Verify if an argument of ‘HELO’ (‘EHLO’) command is valid. To use this function, load ‘heloarg_test.mf’ module (see section Modules).

Arguments:

arg

HELO’ (‘EHLO’) argument. Typically, the value of $s Sendmail macro;

remote_ip

IP address of the remote client. Typically, the value of $client_addr Sendmail macro;

local_ip

IP address of this SMTP server;

The function returns a number describing the result of the test, as described in the following table.

Code Meaning
HELO_SUCCESS arg successfully passes all tests.
HELO_MYIP arg is our IP address.
HELO_IPNOMATCH arg is an IP, but it does not match the remote party IP address.
HELO_ARGNORESOLVE arg is an IP, but it does not resolve.
HELO_ARGNOIP arg is in square brackets, but it is not an IP address.
HELO_ARGINVALID arg is not an IP address and does not resolve to one.
HELO_MYSERVERIP arg resolves to our server IP.
HELO_IPMISMATCH arg does not resolve to the remote client IP address.