Dear Wietse,

On 2023-12-15 22:17:08 +0100, Wietse Venema via Postfix-users wrote:
Peter Wienemann via Postfix-users:
Thanks Wietse! Your pseudo-code clarifies the approach chosen by
Postfix. What still remains unclear to me is the order in which
destinations are tried. Let us again consider the following example:

relayhost = mail1.example.com, mail2.example.com

I think RFC 5321 requires that one starts with MX records before falling
back to A or AAAA records (unless [] notation is used). So my guess is
that the trial sequence starts in the following way:

No. Given destinations (d1, d2), the pesudocode is:
for each destination d in (d1, d2):

          try to deliver the remaining recipients to destination d

          if no recipients remain, stop.

      defer any remaining recipients

The "program then "executes" the following steps:

      try to deliver the remaining recipients to destination d1

      if no recipients remain, stop.

      try to deliver the remaining recipients to destination d2

      if no recipients remain, stop.

      defer any remaining recipients.

(falling back to A/AAAA records after trying MX records)

There is no such thing as falling back to A or AAAA records after
trying MX records. The two are mutually exclusive.

I am confused by the last two sentences. Let us consider a relay host entry "example.com".

Case 1: "example.com" has the following DNS entries:

MX: host1 (with ip1)
A: ip2
AAAA: ip3

My understanding of RFC 5321, Section 5.1 is that delivery has to be attempted to ip1. If ip1 is unavailable, retry later until ip1 becomes available or give-up time has been reached. In that case A and AAAA records will never be used.

If the relayhost entry is

relayhost = [example.com]

either ip2 or ip3 is tried for delivery. I suppose that in that case it depends on the "smtp_address_preference" setting whether ip2 or ip3 will "win".

Case 2: "example.com" has the following DNS entries:

A: ip2
AAAA: ip3

An MX record is checked for example.com and returns no entry. In that case RFC 5321 foresees (at least as I understand it) to fall back to A or AAAA entries ("implicit MX" rule). That means in that case either ip2 or ip3 is tried for delivery (similar to the [example.com] case).

Does the above summarize Postfix's behaviour correctly?

If this is the case, I wonder what happens in the following situation:

relayhost = example1.com, example2.com

with the following DNS entries:

example1.com:
A: ip4

example2.com:
MX: host5 (with ip5)
A: ip6

Assuming all IPs are accessible, will Postfix deliver emails to ip4 (because example1.com is first in the relayhost list) or ip5 (because MX records "win")?

Best regards,

Peter
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to