On Tue, Sep 14, 2021 at 01:20:03PM +1000, raf <post...@raf.org> wrote:
> On Mon, Sep 13, 2021 at 11:07:27AM +0200, Max-Julian Pogner > <max-jul...@pogner.at> wrote: > > > Hi there, > > > > when a user clicks "send", the email client has to make some tcp-connection > > to some ip address. > > what if the hostname configured at the email client resolves to multiple ip > > addresses? > > > > i actually know the theory (either round-robin, or just the first, or try > > first and if fail then try next, possibilities to react if server is running > > but only makes garbage responses, etc..), but what behaviour do the "big" > > email clients actually perform? > > > > i couldn't find the slightest answer using my google fu, nor does any email > > client of interest to me (ms outlook, thunderbird, k-9, whatever iphone is > > doing) seem to publish any kind of documentation in that regard. > > > > could someone suggest me a page to read next or google search word to try > > out? > > > > best regards, > > Max > > I just searched "what happens where dns query returns multiple ip addresses?" > and found: > > > https://serverfault.com/questions/264799/what-is-the-purpose-of-a-dns-server-returning-more-than-1-a-record/264804 > > https://serverfault.com/questions/102879/how-do-dns-clients-choose-an-ip-address-when-they-get-multiple-answers > https://en.wikipedia.org/wiki/Round-robin_DNS > > One answer (by Wes Hardaker who knows things) says that > the specifications say to ideally pick one at random, > but that in practice, load balancers are used instead > of multiple A/AAAA records. > > Other answers say that clients decide what to do, and > that many web browsers try the first, but if that > fails, try the next. That might be true, I suppose. > > Also, if the client can identify an address as being > "closer", in terms of subnet or remembered round trip > times, it might use that one. But that sounds more > complicated than it's worth. That sort of optimization > tends to be managed at the other end by Content > Delivery Networks (CDNs). But you already knew all that. If you are only interested in what mail clients do, and can't find any online explanation, you could either look at the source code to some open source ones (probably the easiest way), or set up a mail smarthost with multiple IP addresses, and send an email through it, recording traffic with tcpdump. But chances are that mail clients just do what any other TCP client would do. That might be why you can't find any discussion on the topic. Remember, the only IP address(es) that the mail client will be concerned with is that of its smarthost. In most cases, that will be an ISP that only has to deal with its own customers, not the whole planet, so there will usually only be one IP address (or one per region). So the mail clients might not have ever needed to put much thought into it. cheers, raf