If you find an "Invalid Token" error mentioned in the LastErrorText after trying to establish an SSL connection in an Chilkat component supporting SSL (SMTP, POP3, IMAP, HTTP, FTP, etc.), it’s usually because your program is trying to establish an SSL connection on the non-SSL port.
DllDate: Sep 21 2007
Component: Visual C++ 7.0
Connecting to SMTP server smtp.gmail.com:587
Aborting because of fatal error
Error performing handshake
Failed to connect to secure SMTP (1)
Failed to connect to SMTP server.
In this case, port 587 is the non-SSL port for GMail. To establish an SSL connection with GMail (and most other SMTP servers) you would use port 465. The port number will always be included in the LastErrorText. If you see an "Invalid Token" combined with port 25 (or 587) for SMTP, port 110 for POP3, port 143 for IMAP, port 80 for HTTP, or port 21 for FTP, then you know this is the problem.
Why do you get "Invalid Token"? It’s because the SSL client-side software is expecting the first part of a binary SSL handshake to establish the connection. When it receives a us-ascii "Hello" greeting from the server, it’s not a valid SSL token.