More flexible authentication.

Starttls occurs only if needed.
Added read of auth mechanism and the first one from the list is used
(if supported).