I wrote an application that polls an inbox for attachments to download and process. I'm re-writing the application to be more robust, and so I decided to give chilkat a try (as opposed to another component I was using).

I've set up a class file to wrap up some of the functionality such as initialization. In my initialization, I assigned all of the basic connection commands and verified the values were correct (per my previous project that worked fine - connection settings, etc.).

Thanks for posting! The "Command is not valid in this state" is the cryptic and confusing way that MS Exchange is trying to say "I'm not configured to allow for passwords to be sent unencrypted over the network."

The solution is to make sure the connection is SSL/TLS. As with most other protocols, this can be done "implicitly" or "explicitly". Implicit means that you'll connect to the server's alternative port for SSL/TLS connections. For POP3, the standard port for implicit SSL/TLS connections is 995. When connecting to the implicit SSL/TLS port, the SSL/TLS channel is immediately (implicitly) established. The Chilkat properties to set for POP3 implicit SSL are MailPort (set equal to 995) and PopSsl (set equal to True).

Explicit means that you'll connect to the standard unencrypted port, and then a command is sent to explicitly convert the unencrypted TCP/IP connection to a secure SSL/TLS channel. To do this in Chilkat, leave PopSsl = False, but set the Pop3Stls property = True. Chilkat will automatically convert the connection to SSL/TLS after connecting.

Another possible option is to use Secure Password Authentication (SPA). This allows for the connection to remain unencrypted, but the authentication uses a protocol (such as NTLM) where the password is never actually sent over the network. These authentication protocols work by doing a quick back-and-forth exchange of information that allows the server to know that the client is in possession of the correct password.