Archived Forum Post

Index of archived forum posts

Question:

Failed to read SSL/TLS application messages.

Apr 05 '13 at 10:41

Hi,

I try to send a mail with the ChilkatDotNet4 dll but I have a problem. The application returns me this error :

           ...
          --readIncomingTls_handshakeFinished2
          Dequeue the FINISHED message...
          Dequeued Finished message.
          Handshake completed successfully.
        --clientHandshake
        Secure Channel Established.
      --establishChannel2_1
    --ConvertToTls_12
    tlsRecvAppData:
      readIncomingTls_appData:
        Timeout waiting to read socket or accept connection
        timeoutMs: 30000
        Timed out waiting for incoming SSL/TLS messages.
        timeoutMs: 30000
      --readIncomingTls_appData
      Failed to read SSL/TLS application messages.
    --tlsRecvAppData
    Failed to receive more bytes.
    InitialResponse2: 
    Failed to get initial SMTP response again.
  --SMTP_Connect
  ...

And here's my code :

        MailMan mailman = new MailMan();
        bool success;
        success = mailman.UnlockComponent("30-day trial");
        if (success != true)
            MessageBox.Show("Component unlock failed");
        else
        {
            // proxy's parameters
            mailman.HttpProxyHostname = "D78-proxy"; // my company's proxy
            mailman.HttpProxyPort = 8080; 
            mailman.HttpProxyUsername = maSession;
            mailman.HttpProxyPassword = monMotDePasse;
            // smtp parameters
            mailman.SmtpHost = "webmail.osiatis.com";
            mailman.SmtpPort = 443;
            mailman.SmtpSsl = true;
            mailman.SmtpUsername = mailExpediteur;
            mailman.SmtpPassword = mdpExpediteur;

            Email mail = new Email();
            mail.Subject = objet;
            mail.Body = message;
            mail.From = mailExpediteur;
            mail.AddTo("Toto", mailDestinataire);
            mailman.SendEmail(mail);

I don't know what to do. If somebody have any suggestion...


Answer

Port 443 is not an SMTP port. When a client connects to a server, they must both be speaking the same protocol. In other words, SMTP clients should connect to SMTP servers -- NOT HTTP servers. Port 80 and 443 are the ports at which HTTP servers listen.


Answer

PS> The error makes sense because when an SMTP client connects to an SMTP server, it expects the SMTP greeting -- i.e. the first communications between the client and server is the server sending a greeting to the client. However, when an HTTP client connects to an HTTP server, that protocol is such that the HTTP request is sent from the client to the server, and then the server responds. Therefore, if an SMTP client connects to an HTTP server, the SMTP client is waiting for an SMTP greeting (from the server), but the HTTP server is waiting for the HTTP request (from the client). The result is, of course, a timeout, because neither side is going to get what it wants, because they are speaking different protocols...


Answer

Thanks for your answer,

I understand what you explained but I don't know what to do with my code. I don't know much about networking, so I'm a bit lost... Do I change the SMTP port? If yes what kind of SMTP port?


Answer

Default Ports:

  • SMTP AUTH: Port 25 or 587 (some ISPs are blocking port 25)
  • SMTP StartTLS Port 587
  • SMTP SSL Port 465
  • POP Port 110
  • POP SSL Port 995

  • I googled "SMTP port" and chose A List of SMTP and POP3 Servers


    Answer

    Thank you Blaze for your answer,

    I tested all the SMTP port you send to me but unfortunately no one works. Each SMTP port send me this error :

    HttpProxyConnect:

    proxyHostname: D78-proxy

    proxyPort: 8080 proxyUsername: OSIADVLTriantl ConnectTimeoutMs_1: 30000 calling ConnectSocket2 IPV6 enabled connect with NO heartbeat. connectingTo: D78-proxy resolveHostname1: Resolving domain name (IPV4) via gethostbyname --resolveHostname1 GetHostByNameHB_ipv4: Elapsed time: 16 millisec myIP_1: 10.78.170.106 myPort_1: 2704 connect successful (1) ConnectRequest: CONNECT webmail.osiatis.com:995 HTTP/1.1 Connection: Keep-Alive Proxy-Connection: Keep-Alive Host: webmail.osiatis.com ConnectResponseHeader: HTTP/1.1 502 Proxy Error ( Le port SSL (Secure Sockets Layer) spécifié n'est pas autorisé. ISA Server n'est pas configuré pour autoriser les demandes SSL à partir de ce port. La plupart des navigateurs Web utilisent le port 443 pour les demandes SSL. ) Via: 1.1 D78-PROXY Connection: close Proxy-Connection: close


    Answer

    Sorry for the not indented error.

        HttpProxyConnect:
          proxyHostname: D78-proxy
          proxyPort: 8080
          proxyUsername: OSIADVLTriantl
          ConnectTimeoutMs_1: 30000
          calling ConnectSocket2
          IPV6 enabled connect with NO heartbeat.
          connectingTo: D78-proxy
          resolveHostname1:
            Resolving domain name (IPV4) via gethostbyname
          --resolveHostname1
          GetHostByNameHB_ipv4: Elapsed time: 16 millisec
          myIP_1: 10.78.170.106
          myPort_1: 2704
          connect successful (1)
          ConnectRequest: CONNECT webmail.osiatis.com:995 HTTP/1.1
    
            Connection: Keep-Alive
            Proxy-Connection: Keep-Alive
            Host: webmail.osiatis.com
            ConnectResponseHeader: HTTP/1.1 502 Proxy 
            **Error ( Le port SSL (Secure Sockets Layer) spécifié n'est
            pas autorisé. ISA Server n'est pas
            configuré pour autoriser les demandes
            SSL à partir de ce port. La plupart
            des navigateurs Web utilisent le port
            443 pour les demandes SSL.  )**
            Via: 1.1 D78-PROXY
            Connection: close
            Proxy-Connection: close
    

    That's why I tried to use the 443 SMTP port...


    Answer

    Whenever I set up a new email client to read a newly created mailbox, I always check the available help documentation from the email provider to see which ports need to be set. It might help to confer with them to ensure you are using the correct settings. Also, to take a page from a troubleshooting article for another chilkat method, you could try setting up a well known email client such as outlook or thunderbird. If you are able to successfully establish a connection, then you can use the port settings that the email client used. And if it still fails, you will at least know more about the problem.