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.
For example:
SendEmail:
DllDate: Sep 21 2007
Username: Administrator
Component: Visual C++ 7.0
SMTP_Connect:
Connecting to SMTP server smtp.gmail.com:587
smtp_host: smtp.gmail.com
smtp_port: 587
smtp_user: somebody@gmail.com
Invalid token.
scRet: 80090308
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.