Previous Section Next Section

${client_name}

The connecting host's canonical name V8.8 and above

The ${client_name} macro is assigned its value when a host connects to the running daemon. This macro holds as its value the canonical hostname of that connecting host, which is the same as the hostname stored in the $_ macro.

The ${client_name} macro is useful in the Local_check_rcpt (Section 7.1.3) and Local_check_mail (Section 7.1.2) rule sets. It can, for example, be used to see whether the connecting host is your firewall machine:

LOCAL_CONFIG
D{FireWallHost}fw.our.domain

LOCAL_RULESETS
SLocal_check_mail
R $*                     $: $&{client_name}
R ${FireWallHost}        $@ Okay our firewall machine
R $*                     $#error $@ 5.7.1 $: "550 can accept only from our firewall"

Here, the first rule transfers the value of ${client_name} into the workspace. The $& prefix (Section 21.5.3) prevents that macro from wrongly being expanded when the configuration file is read. The second rule compares the name of the firewall to that workspace. If they match, the connecting host was, indeed, the firewall machine.

${client_name} is transient. If it is defined in the configuration file or in the command line, that definition can be ignored by sendmail. Note that ${client_name} is not guaranteed to be available in the check_compat rule set (Section 7.1.4). Also note that a $& prefix is necessary when you reference this macro in rules (that is, use $&{client_name}, not ${client_name}).

    Previous Section Next Section