public int CheckMailQuantity() { using (var emailClient = new Pop3Client()) { emailClient.Connect(_emailConfiguration.PopServer, _emailConfiguration.PopPort, true); emailClient.AuthenticationMechanisms.Remove("XOAUTH2"); emailClient.Authenticate(_emailConfiguration.PopUsername, _emailConfiguration.PopPassword); return(emailClient.Count()); } }