From: Wietse Venema
@@ -9735,7 +9737,7 @@ This feature is available in Postfix 2.0 and later. (default: empty)
-The next-hop destination of non-local mail; overrides non-local +The next-hop destination(s) for non-local mail; overrides non-local domains in recipient addresses. This information is overruled with relay_transport, sender_dependent_default_transport_maps, default_transport, sender_dependent_relayhost_maps @@ -9749,9 +9751,11 @@ gateway host instead.
-In the case of SMTP, specify a domain name, hostname, hostname:port, -[hostname]:port, [hostaddress] or [hostaddress]:port. The form -[hostname] turns off MX lookups. +In the case of SMTP or LMTP delivery, specify one or more destinations +in the form of a domain name, hostname, hostname:port, [hostname]:port, +[hostaddress] or [hostaddress]:port, separated by comma or whitespace. +The form [hostname] turns off MX lookups. Multiple destinations are +supported in Postfix 3.5 and later.
@@ -9766,7 +9770,7 @@ Examples:
relayhost = $mydomain relayhost = [gateway.example.com] -relayhost = uucphost +relayhost = mail1.example:587, mail2.example:587 relayhost = [an.ip.add.ress]diff --git a/postfix/html/smtp.8.html b/postfix/html/smtp.8.html index 9fc75ac35..68f79273e 100644 --- a/postfix/html/smtp.8.html +++ b/postfix/html/smtp.8.html @@ -41,7 +41,9 @@ SMTP(8) SMTP(8) can be enabled permanently for specific destinations. SMTP DESTINATION SYNTAX - SMTP destinations have the following form: + The Postfix SMTP+LMTP client supports multiple destinations separated + by comma or whitespace (Postfix 3.5 and later). SMTP destinations have + the following form: domainname @@ -63,7 +65,9 @@ SMTP(8) SMTP(8) ted as [ipv6:address]. LMTP DESTINATION SYNTAX - LMTP destinations have the following form: + The Postfix SMTP+LMTP client supports multiple destinations separated + by comma or whitespace (Postfix 3.5 and later). LMTP destinations have + the following form: unix:pathname Connect to the local UNIX-domain server that is bound to the diff --git a/postfix/html/transport.5.html b/postfix/html/transport.5.html index b1771abac..05da59f70 100644 --- a/postfix/html/transport.5.html +++ b/postfix/html/transport.5.html @@ -134,13 +134,17 @@ TRANSPORT(5) TRANSPORT(5) (the first name of a mail delivery service entry in the Postfix mas- ter.cf file). - The interpretation of the nexthop field is transport dependent. In the - case of SMTP, specify a service on a non-default port as host:service, - and disable MX (mail exchanger) DNS lookups with [host] or [host]:port. - The [] form is required when you specify an IP address instead of a - hostname. + The nexthop field usually specifies one recipient domain or hostname. + In the case of the Postfix SMTP/LMTP client, the nexthop field may con- + tain a list of nexthop destinations separated by comma or whitespace + (Postfix 3.5 and later). - A null transport and null nexthop result means "do not change": use the + The syntax of a nexthop destination is transport dependent. With SMTP, + specify a service on a non-default port as host:service, and disable MX + (mail exchanger) DNS lookups with [host] or [host]:port. The [] form is + required when you specify an IP address instead of a hostname. + + A null transport and null nexthop field means "do not change": use the delivery transport and nexthop information that would be used when the entire transport table did not exist. @@ -185,7 +189,7 @@ TRANSPORT(5) TRANSPORT(5) In the above example, the [] suppress MX lookups. This prevents mail routing loops when your machine is primary MX host for example.com. - In the case of delivery via SMTP, one may specify hostname:service + In the case of delivery via SMTP or LMTP, one may specify host:service instead of just a host: example.com smtp:bar.example:2025 @@ -194,6 +198,14 @@ TRANSPORT(5) TRANSPORT(5) Instead of a numerical port a symbolic name may be used. Specify [] around the hostname if MX lookups must be disabled. + Deliveries via SMTP or LMTP support multiple destinations (Postfix >= + 3.5): + + example.com smtp:bar.example, foo.example + + This tries to deliver to bar.example before trying to deliver to + foo.example. + The error mailer can be used to bounce mail: .example.com error:mail for *.example.com is not deliverable @@ -234,16 +246,17 @@ TRANSPORT(5) TRANSPORT(5) below provides only a parameter summary. See postconf(5) for more details including examples. - empty_address_recipient - The address that is looked up instead of the null sender - address. + empty_address_recipient (MAILER-DAEMON) + The recipient of mail addressed to the null address. - parent_domain_matches_subdomains - List of Postfix features that use domain.tld patterns to match - sub.domain.tld (as opposed to requiring .domain.tld patterns). + parent_domain_matches_subdomains (see 'postconf -d' output) + A list of Postfix features where the pattern "example.com" also + matches subdomains of example.com, instead of requiring an + explicit ".example.com" pattern. - transport_maps - List of transport lookup tables. + transport_maps (empty) + Optional lookup tables with mappings from recipient address to + (message delivery transport, next-hop destination). SEE ALSO trivial-rewrite(8), rewrite and resolve addresses diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index 130a6bf25..00544d338 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -1698,7 +1698,9 @@ domain. Specify a string of the form \fItransport:nexthop\fR, where \fItransport\fR is the name of a mail delivery transport defined in master.cf. The \fI:nexthop\fR destination is optional; its syntax is documented -in the manual page of the corresponding delivery agent. +in the manual page of the corresponding delivery agent. In the case of +SMTP or LMTP, specify one or more destinations separated by comma or +whitespace (with Postfix 3.5 and later). .PP Example: .PP @@ -6028,7 +6030,7 @@ file. .PP This feature is available in Postfix 2.0 and later. .SH relayhost (default: empty) -The next\-hop destination of non\-local mail; overrides non\-local +The next\-hop destination(s) for non\-local mail; overrides non\-local domains in recipient addresses. This information is overruled with relay_transport, sender_dependent_default_transport_maps, default_transport, sender_dependent_relayhost_maps @@ -6038,9 +6040,11 @@ On an intranet, specify the organizational domain name. If your internal DNS uses no MX records, specify the name of the intranet gateway host instead. .PP -In the case of SMTP, specify a domain name, hostname, hostname:port, -[hostname]:port, [hostaddress] or [hostaddress]:port. The form -[hostname] turns off MX lookups. +In the case of SMTP or LMTP delivery, specify one or more destinations +in the form of a domain name, hostname, hostname:port, [hostname]:port, +[hostaddress] or [hostaddress]:port, separated by comma or whitespace. +The form [hostname] turns off MX lookups. Multiple destinations are +supported in Postfix 3.5 and later. .PP If you're connected via UUCP, see the UUCP_README file for useful information. @@ -6052,7 +6056,7 @@ Examples: .ft C relayhost = $mydomain relayhost = [gateway.example.com] -relayhost = uucphost +relayhost = mail1.example:587, mail2.example:587 relayhost = [an.ip.add.ress] .fi .ad diff --git a/postfix/man/man5/transport.5 b/postfix/man/man5/transport.5 index 02b1c9035..aac9f7616 100644 --- a/postfix/man/man5/transport.5 +++ b/postfix/man/man5/transport.5 @@ -143,13 +143,18 @@ The transport field specifies the name of a mail delivery transport (the first name of a mail delivery service entry in the Postfix \fBmaster.cf\fR file). -The interpretation of the nexthop field is transport -dependent. In the case of SMTP, specify a service on a non\-default +The nexthop field usually specifies one recipient domain +or hostname. In the case of the Postfix SMTP/LMTP client, +the nexthop field may contain a list of nexthop destinations +separated by comma or whitespace (Postfix 3.5 and later). + +The syntax of a nexthop destination is transport dependent. +With SMTP, specify a service on a non\-default port as \fIhost\fR:\fIservice\fR, and disable MX (mail exchanger) DNS lookups with [\fIhost\fR] or [\fIhost\fR]:\fIport\fR. The [] form is required when you specify an IP address instead of a hostname. -A null \fItransport\fR and null \fInexthop\fR result means "do +A null \fItransport\fR and null \fInexthop\fR field means "do not change": use the delivery transport and nexthop information that would be used when the entire transport table did not exist. @@ -207,8 +212,8 @@ In the above example, the [] suppress MX lookups. This prevents mail routing loops when your machine is primary MX host for \fBexample.com\fR. -In the case of delivery via SMTP, one may specify -\fIhostname\fR:\fIservice\fR instead of just a host: +In the case of delivery via SMTP or LMTP, one may specify +\fIhost\fR:\fIservice\fR instead of just a host: .nf \fBexample.com smtp:bar.example:2025\fR @@ -218,6 +223,16 @@ This directs mail for \fIuser\fR@\fBexample.com\fR to host \fBbar.example\fR port \fB2025\fR. Instead of a numerical port a symbolic name may be used. Specify [] around the hostname if MX lookups must be disabled. +Deliveries via SMTP or LMTP support multiple destinations +(Postfix >= 3.5): + +.nf + \fBexample.com smtp:bar.example, foo.example\fR +.fi + +This tries to deliver to \fBbar.example\fR before trying +to deliver to \fBfoo.example\fR. + The error mailer can be used to bounce mail: .nf @@ -271,14 +286,15 @@ Results are the same as with indexed file lookups. The following \fBmain.cf\fR parameters are especially relevant. The text below provides only a parameter summary. See \fBpostconf\fR(5) for more details including examples. -.IP \fBempty_address_recipient\fR -The address that is looked up instead of the null sender address. -.IP \fBparent_domain_matches_subdomains\fR -List of Postfix features that use \fIdomain.tld\fR patterns -to match \fIsub.domain.tld\fR (as opposed to -requiring \fI.domain.tld\fR patterns). -.IP \fBtransport_maps\fR -List of transport lookup tables. +.IP "\fBempty_address_recipient (MAILER\-DAEMON)\fR" +The recipient of mail addressed to the null address. +.IP "\fBparent_domain_matches_subdomains (see 'postconf -d' output)\fR" +A list of Postfix features where the pattern "example.com" also +matches subdomains of example.com, +instead of requiring an explicit ".example.com" pattern. +.IP "\fBtransport_maps (empty)\fR" +Optional lookup tables with mappings from recipient address to +(message delivery transport, next\-hop destination). .SH "SEE ALSO" .na .nf diff --git a/postfix/man/man8/smtp.8 b/postfix/man/man8/smtp.8 index 6023c4f61..a7d9646f6 100644 --- a/postfix/man/man8/smtp.8 +++ b/postfix/man/man8/smtp.8 @@ -46,6 +46,8 @@ specific destinations. .nf .ad .fi +The Postfix SMTP+LMTP client supports multiple destinations +separated by comma or whitespace (Postfix 3.5 and later). SMTP destinations have the following form: .IP \fIdomainname\fR .IP \fIdomainname\fR:\fIport\fR @@ -65,6 +67,8 @@ must be formatted as [\fBipv6\fR:\fIaddress\fR]. .nf .ad .fi +The Postfix SMTP+LMTP client supports multiple destinations +separated by comma or whitespace (Postfix 3.5 and later). LMTP destinations have the following form: .IP \fBunix\fR:\fIpathname\fR Connect to the local UNIX\-domain server that is bound to the specified diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 4bb329ee6..5bc0ec5a2 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -1310,7 +1310,9 @@ domain. Specify a string of the form transport:nexthop, where transport is the name of a mail delivery transport defined in master.cf. The :nexthop destination is optional; its syntax is documented -in the manual page of the corresponding delivery agent. +in the manual page of the corresponding delivery agent. In the case of +SMTP or LMTP, specify one or more destinations separated by comma or +whitespace (with Postfix 3.5 and later).
@@ -3773,7 +3775,7 @@ This feature is available in Postfix 2.0 and later. %PARAM relayhost
-The next-hop destination of non-local mail; overrides non-local +The next-hop destination(s) for non-local mail; overrides non-local domains in recipient addresses. This information is overruled with relay_transport, sender_dependent_default_transport_maps, default_transport, sender_dependent_relayhost_maps @@ -3787,9 +3789,11 @@ gateway host instead.
-In the case of SMTP, specify a domain name, hostname, hostname:port, -[hostname]:port, [hostaddress] or [hostaddress]:port. The form -[hostname] turns off MX lookups. +In the case of SMTP or LMTP delivery, specify one or more destinations +in the form of a domain name, hostname, hostname:port, [hostname]:port, +[hostaddress] or [hostaddress]:port, separated by comma or whitespace. +The form [hostname] turns off MX lookups. Multiple destinations are +supported in Postfix 3.5 and later.
@@ -3804,7 +3808,7 @@ Examples:
relayhost = $mydomain relayhost = [gateway.example.com] -relayhost = uucphost +relayhost = mail1.example:587, mail2.example:587 relayhost = [an.ip.add.ress]diff --git a/postfix/proto/transport b/postfix/proto/transport index be0771126..49b3441d8 100644 --- a/postfix/proto/transport +++ b/postfix/proto/transport @@ -129,13 +129,18 @@ # (the first name of a mail delivery service entry in the Postfix # \fBmaster.cf\fR file). # -# The interpretation of the nexthop field is transport -# dependent. In the case of SMTP, specify a service on a non-default +# The nexthop field usually specifies one recipient domain +# or hostname. In the case of the Postfix SMTP/LMTP client, +# the nexthop field may contain a list of nexthop destinations +# separated by comma or whitespace (Postfix 3.5 and later). +# +# The syntax of a nexthop destination is transport dependent. +# With SMTP, specify a service on a non-default # port as \fIhost\fR:\fIservice\fR, and disable MX (mail exchanger) # DNS lookups with [\fIhost\fR] or [\fIhost\fR]:\fIport\fR. The [] form # is required when you specify an IP address instead of a hostname. # -# A null \fItransport\fR and null \fInexthop\fR result means "do +# A null \fItransport\fR and null \fInexthop\fR field means "do # not change": use the delivery transport and nexthop information # that would be used when the entire transport table did not exist. # @@ -191,8 +196,8 @@ # This prevents mail routing loops when your machine is primary MX # host for \fBexample.com\fR. # -# In the case of delivery via SMTP, one may specify -# \fIhostname\fR:\fIservice\fR instead of just a host: +# In the case of delivery via SMTP or LMTP, one may specify +# \fIhost\fR:\fIservice\fR instead of just a host: # # .nf # \fBexample.com smtp:bar.example:2025\fR @@ -202,6 +207,16 @@ # port \fB2025\fR. Instead of a numerical port a symbolic name may be # used. Specify [] around the hostname if MX lookups must be disabled. # +# Deliveries via SMTP or LMTP support multiple destinations +# (Postfix >= 3.5): +# +# .nf +# \fBexample.com smtp:bar.example, foo.example\fR +# .fi +# +# This tries to deliver to \fBbar.example\fR before trying +# to deliver to \fBfoo.example\fR. +# # The error mailer can be used to bounce mail: # # .nf @@ -249,14 +264,15 @@ # The following \fBmain.cf\fR parameters are especially relevant. # The text below provides only a parameter summary. See # \fBpostconf\fR(5) for more details including examples. -# .IP \fBempty_address_recipient\fR -# The address that is looked up instead of the null sender address. -# .IP \fBparent_domain_matches_subdomains\fR -# List of Postfix features that use \fIdomain.tld\fR patterns -# to match \fIsub.domain.tld\fR (as opposed to -# requiring \fI.domain.tld\fR patterns). -# .IP \fBtransport_maps\fR -# List of transport lookup tables. +# .IP "\fBempty_address_recipient (MAILER-DAEMON)\fR" +# The recipient of mail addressed to the null address. +# .IP "\fBparent_domain_matches_subdomains (see 'postconf -d' output)\fR" +# A list of Postfix features where the pattern "example.com" also +# matches subdomains of example.com, +# instead of requiring an explicit ".example.com" pattern. +# .IP "\fBtransport_maps (empty)\fR" +# Optional lookup tables with mappings from recipient address to +# (message delivery transport, next-hop destination). # SEE ALSO # trivial-rewrite(8), rewrite and resolve addresses # master(5), master.cf file format diff --git a/postfix/src/global/mail_params.c b/postfix/src/global/mail_params.c index c8e227be0..8b4ad0ba4 100644 --- a/postfix/src/global/mail_params.c +++ b/postfix/src/global/mail_params.c @@ -974,10 +974,6 @@ void mail_params_init() msg_fatal("%s parameter setting must not contain multiple values: %s", VAR_MYORIGIN, var_myorigin); - if (var_relayhost[strcspn(var_relayhost, CHARS_COMMA_SP)]) - msg_fatal("%s parameter setting must not contain multiple values: %s", - VAR_RELAYHOST, var_relayhost); - /* * One more sanity check. */ diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index edf56475d..ba42397c4 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20200105" +#define MAIL_RELEASE_DATE "20200111" #define MAIL_VERSION_NUMBER "3.5" #ifdef SNAPSHOT diff --git a/postfix/src/smtp/smtp.c b/postfix/src/smtp/smtp.c index a3aebb380..73047b182 100644 --- a/postfix/src/smtp/smtp.c +++ b/postfix/src/smtp/smtp.c @@ -38,6 +38,8 @@ /* SMTP DESTINATION SYNTAX /* .ad /* .fi +/* The Postfix SMTP+LMTP client supports multiple destinations +/* separated by comma or whitespace (Postfix 3.5 and later). /* SMTP destinations have the following form: /* .IP \fIdomainname\fR /* .IP \fIdomainname\fR:\fIport\fR @@ -55,6 +57,8 @@ /* LMTP DESTINATION SYNTAX /* .ad /* .fi +/* The Postfix SMTP+LMTP client supports multiple destinations +/* separated by comma or whitespace (Postfix 3.5 and later). /* LMTP destinations have the following form: /* .IP \fBunix\fR:\fIpathname\fR /* Connect to the local UNIX-domain server that is bound to the specified diff --git a/postfix/src/smtp/smtp_connect.c b/postfix/src/smtp/smtp_connect.c index aad48e409..4d4888331 100644 --- a/postfix/src/smtp/smtp_connect.c +++ b/postfix/src/smtp/smtp_connect.c @@ -784,11 +784,10 @@ static void smtp_connect_inet(SMTP_STATE *state, const char *nexthop, } /* - * Future proofing: do a null destination sanity check in case we allow - * the primary destination to be a list (it could be just separators). + * Do a null destination sanity check in case the primary destination is + * a list that consists of only separators. */ - sites = argv_alloc(1); - argv_add(sites, nexthop, (char *) 0); + sites = argv_split(nexthop, CHARS_COMMA_SP); if (sites->argc == 0) msg_panic("null destination: \"%s\"", nexthop); non_fallback_sites = sites->argc;