On Wed, Feb 13, 2019 at 03:52:54PM +0000, Dominic Raferd wrote: > > With hostnames the [] are optional and usually not used. > > OT: is this true generally or just for milter lookups?
Generally, yes, but naturally not for the SMTP nexthop syntax. After all, MX lookups are an SMTP-only feature, and are are not applicable in locating milters, policy services, ... One obvious difference is that milters require an "inet:" or "unix:" prefix, but the SMTP nexthop syntax does not. LMTP (implemented in the same underlying executable as SMTP) also does not use MX lookups, and its nexthop syntax is closer to that of milters: http://www.postfix.org/lmtp.8.html LMTP DESTINATION SYNTAX LMTP destinations have the following form: unix:pathname Connect to the local UNIX-domain server that is bound to the specified pathname. If the process runs chrooted, an absolute pathname is interpreted relative to the Postfix queue directory. inet:hostname inet:hostname:port inet:[address] inet:[address]:port Connect to the specified TCP port on the specified local or remote host. If no port is specified, connect to the port defined as lmtp in services(4). If no such service is found, the lmtp_tcp_port configuration parameter (default value of 24) will be used. An IPv6 address must be formatted as [ipv6:address]. > I thought that for hostname-based relay transports (for example), > including in transport_maps, it was recommended to use [] to > prevent repeated unnecessary MX/DNS lookups? e.g. > > # postconf relayhost > relayhost = [smtp.talktalk.net] This is a matter of *correctness* not efficiency. If, with SMTP, you mean to connect to a specific host, then say so, by enclosing the hostname in []. If you mean to connect to the MX hosts of a particular domain, then leave the [] out. Whichover one is the correct way to reach the destination, the other one is liable to wrong in many cases. Some destinations will resolve to the same set of IP addresses either way, but you should not depend on that. -- Viktor.