POP3: Login to the server
pop3.Username = "user"; pop3.Password = "pass"; pop3.Login();
There are several authorization methods available in POP3 protocol: plain (USER/PASS commands), digest (APOP command) and SASL (this one supports a lot of mechanisms). It's possible to enable or disable any of these authorization methods. If several authorization methods are allowed, they are used according to their priorities.
// use only plain and SASL authorizations pop3.set_Authorization(SBPOP3Client.__Global.popUser, true); pop3.set_Authorization(SBPOP3Client.__Global.popAPOP, false); pop3.set_Authorization(SBPOP3Client.__Global.popSASL, true); // but prefer SASL pop3.set_AuthorizationPriorities(SBPOP3Client.__Global.popSASL, 100); pop3.set_AuthorizationPriorities(SBPOP3Client.__Global.popUser, 10);
Servers report supported authorization methods. Inspect the values of ExtUSERSupported, ExtAPOPSupported and ExtSASLSupported properties to find out, what authorization methods are supported on the particular server.
If the server supports SASL authorization, it also reports what SASL mechanisms it supports. Check ExtSASLMechanisms property for the list of the supported mechanisms. It's possible to enable and disable SASL mechanisms and change their priorities. The following code snippet shows how to enable OAuth 2.0 authorization mechanism and how to set the highest priority to it.
// enable XOAUTH mechanism (for example, to access GMail server) pop3.set_SASLMechanism("XOAUTH2", true); pop3.set_SASLMechanismPriorities("XOAUTH2", 1000);