Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QSslSocket - STARTTLS Connection Problem
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QSslSocket - STARTTLS Connection Problem

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Saugglocke
    wrote on 10 May 2014, 08:16 last edited by
    #1

    Hey,

    I'm trying to implement the SMTP Client from this source: http://morf.lv/modules.php?name=tutorials&lasit=20

    The SSL connection is working properly, but if I'm trying to use STARTTLS it fails to encrypt the connection and reports an unknown error:

    CONNECTED!
    CODE: 220! -> Send EHLO
    CODE: 250! -> startClientEncryption()
    ERROR: QAbstractSocket::UnknownSocketError

    I also tried it this way:

    CONNECTED!
    CODE: 220! -> Send EHLO
    CODE: 250! -> Send STARTTLS
    CODE: 220! -> startClientEncryption()
    ERROR: QAbstractSocket::UnknownSocketError

    Already tried to connect via openssl s_client -connect host:587 -starttls smtp and it's working without issues.
    System: Arch Linux, 64bit

    What am I doing wrong? Maybe some missing libraries?

    Thanks in advance!

    bb

    Edit: QSslSocket::supportsSsl() -> reports true.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rumpi
      wrote on 22 May 2014, 06:57 last edited by
      #2

      Hi Saugglocke,
      I've the same problem. I test the SmtpClient-for-Qt from bluetiger9.
      After starting STARTTLS the Code 220 was received and the following startClientEncryption() ends in a timeout because the destination Mailserver ends the connection.

      220 smtp.1und1.de (mreue104) Welcome to Nemesis ESMTP server
      250-smtp.1und1.de
      250-STARTTLS
      250-AUTH LOGIN PLAIN
      250-AUTH=LOGIN PLAIN
      250-SIZE 120000000
      250 HELP
      220 OK

      connected
      EHLO localhost
      STARTTLS
      Network operation timed out
      SendMessageTimeoutException

      I've started the ClientEncryption with -1 (no timeout) the server also ends this connection.

      The same code running on a Win machine (tested on 32bit and 64bit) with my development environment (VS2012, Qt5.0.1 32bit) works properly and the eMail was sent succesfully.

      220 smtp.1und1.de (mreue104) Welcome to Nemesis ESMTP server
      250-smtp.1und1.de
      250-STARTTLS
      250-AUTH LOGIN PLAIN
      250-AUTH=LOGIN PLAIN
      250-SIZE 120000000
      250 HELP
      220 OK

      connected
      EHLO localhost
      STARTTLS
      EHLO localhost
      235 Authentication successful

      AUTH PLAIN AHNjaGF1bUBtaXJhdG9zLmRlAGlzMDkxMTFjb20=
      250 OK
      250 OK
      250 OK
      354 Enter mail, end with "." on a line by itself
      250 Message 0MB1l6-1WdTQ51B48-009ypw accepted by mreue103.kundenserver.de

      I added some vcredist versions (older MS C++ 2008 versions and the MS C++ 2012 release) but without any success.

      I installed OpenSSL on Win, copied the sslea32y.dll, libeay32.dll and libssl32.dll in my programm directory - nothing.

      Has someone an idea which special dll oder lib is needed for QSslSocket on target Win machine for a 32bit application?

      Thanks.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rumpi
        wrote on 22 May 2014, 10:15 last edited by
        #3

        Hi,
        problem solved - I was on the wrong side of the road...
        It must be copy the original sslea32y.dll, libeay32.dll and libssl32.dll from the development environment machine to target machine, not using new installed dlls from OpenSSL on target.
        Now it works perfectly

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Saugglocke
          wrote on 27 May 2014, 17:00 last edited by
          #4

          Hey rumpi,

          just tested the solution of bluetiger9 and it is working fine!

          Thanks for the reply,

          bb

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved