private void AuthenticateImapPlain(Imap4Client imap) { switch (Account.IncomingEncryptionType) { case EncryptionType.StartTLS: _log.Info("IMAP StartTLS connecting to {0}", Account.EMail); imap.ConnectTLS(Account.Server, Account.Port); break; case EncryptionType.SSL: _log.Info("IMAP SSL connecting to {0}", Account.EMail); imap.ConnectSsl(Account.Server, Account.Port); break; case EncryptionType.None: _log.Info("IMAP connecting to {0}", Account.EMail); imap.Connect(Account.Server, Account.Port); break; } _log.Info("IMAP connecting OK {0}", Account.EMail); _log.Info("IMAP logging in to {0}", Account.EMail); if (Account.AuthenticationTypeIn == SaslMechanism.Login) { imap.Login(Account.Account, Account.Password, ""); } else { imap.Authenticate(Account.Account, Account.Password, Account.AuthenticationTypeIn); } _log.Info("IMAP logged in to {0}", Account.EMail); }