Delay authentication until asked to proceed

This is used so that a client can attempt to connect to a number of
different services, without having the interactive authentication prompt
start for more than one of them.
Try to find mail server automatically

Look for SRV records, first imaps and then imap.
If there are no SRV records, ask user for mail server.
If the user doesn't include a port number, try both 143 with STARTTLS
and 993 with plain TLS.
If the user does include a port number, guess the protocol based on the
port number.  If the port number is neither 143 nor 993, try both and
pick the one that works.

These things are far too tedious to be left to humans.  Computers should
do the hard work!