''${client_port}'' '''


The connecting host's port number V8.10 and above

Rule sets cannot know which port a connecting host used to connect to the listening daemon unless that port number is stored in a macro. This ${client_port} macro holds as its value that port number. This port number should not be confused with the port number on which the listening daemon accepted the connection (usually 25). This is the port number used by the other MTA to establish its outbound connection to your listening daemon.

One use for this macro might be to log the client port so that you can develop a profile of ports used by spam sites (and perhaps find a pattern):

Klog syslog

R $*       $@ $(log Port_Stat &${client_name} $&{client_addr} $&{client_port} $)

Here, we first define a database map of type syslog and name it log. Then we declare the Local_check_mail rule set (Section 7.1.2), which is called just after the MAIL FROM: command is received. The single rule in that rule set uses the log database map to syslog the client's name, address, and port number. The $@ beginning the RHS causes the rule set to return immediately after logging.

${client_port} is transient. If it is defined in the configuration file or in the command line, that definition can be ignored by sendmail. Note that a $& prefix is necessary when you reference this macro in rules (that is, use $&{client_port}, not ${client_port}).

    Part I: Build and Install
    Part II: Administration
    Part III: The Configuration File
    Chapter 21. The D (Define a Macro) Configuration Command
    Chapter 24. The O (Options) Configuration Command