Add support for user-provided IMAP settings; refactor auth.