[SOLVED] QSslSocket - STARTTLS Connection Problem



  • 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.



  • 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.



  • 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



  • Hey rumpi,

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

    Thanks for the reply,

    bb


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.