Network interfaces can have one or more addresses associated with each interface, and each address will have a hostname associated with it. For example, on a machine with two interfaces, the one connected to the outside world might have the name host.your.domain , whereas the interface that is connected to the internal network might have the name host.sub.your.domain . When sendmail first starts up as a listening daemon, it binds to a port on all interfaces or on a particular interface (See this section). It then waits to accept connections from hosts or programs ( clients ) that wish to route mail through it. When a client connects to the local machine, sendmail records the local IP address of the connected-to interface in the ${if_addr} macro (${if_addr}), the family of that address in the ${if_family} macro (${if_family}), and the name associated with the interface over which the connection was made in this ${if_name} macro. If the connection is on the local host's loopback interface, the ${if_name} macro is undefined. The ${if_name} macro can be useful when you are set up to do virtual hosting. You can have sendmail give its greeting message in a form that makes it appear to be the host that is associated with the interface: LOCAL_CONFIG define(`confSMTP_LOGIN_MSG', `$?{if_name}${if_name}$$j$. ESMTP MTA') Here, we define sendmail 's initial greeting message with the SmtpGreetingMessage option (SmtpGreetingMessage). It has one of two forms, depending on whether the ${if_name} contains a value. The conditional macro $? looks up the value in ${if_name} . If that value is non-NULL, the value in ${if_name} is printed. Otherwise, (the $ ) the canonical local hostname is printed (the $j ). The $ . terminates the if test, and a literal ESMTP MTA is always printed: 220 virtual.domain ESMTP MTA the outside interface 220 host.your.domain ESMTP MTA the loopback interface ${if_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 a $& prefix is necessary when you reference this macro in rules (that is, use $&{if_name} , not ${if_name} ). |