Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

Index of Chilkat Blog Posts

October 19, 2007

Invalid Token error when trying to connect with SSL (SMTP, POP3, IMAP, FTP, HTTP)

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:

    DllDate: Sep 21 2007
    Username: Administrator
    Component: Visual C++ 7.0
        Connecting to SMTP server
        smtp_port: 587
    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.

Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.