Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

SMTP Library for QT5



  • I need a library for my app to send E-Mails in case of failures, but I was not successful to find anything that is working and I don't want to add a 200M library to my app. I just need to send text messages (no HTML, no attachments, but it should be still actively maintained and support all servers (no authentication, SSL and TLS). I'm really wondering why there is not a such functionality in QT since there is everything that you can dream of implemented in QT (Serialport, Modbus, etc, etc). I've already tried the simple-mail library that you can find on GitHub (https://github.com/cutelyst/simple-mail) and I was able to compile and use this library on my Linux box, but not on Windows, here I was not able to compile and use it. First I've got tons of warning like that during the compiling process:

    C:\Users\kottmann_h\Documents\QT\simple-mail-master\src\emailaddress.cpp:22: warning: 'SimpleMail::EmailAddress::EmailAddress()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
    EmailAddress::EmailAddress() : d_ptr(new EmailAddressPrivate)

    and at the end tons of linker errors like this:

    C:\Users\kottmann_h\Documents\QT\simple-mail-master\src\emailaddress.cpp:22: error: undefined reference to `__imp__ZTVN10SimpleMail12EmailAddressE'

    The library upon which this library is based on I was able to compile, but it was not working (for at least with smpt.gmail.com):

    https://github.com/bluetiger9/SmtpClient-for-Qt

    Is there somewhere a (small) library for QT that can be easily integrated and fits my (homely) needs that is actively maintained or is there a way to get this simple-mail library to work in Windows?


  • Lifetime Qt Champion

    Hi
    I was able to get "bluetiger" to work on windows with google.

    i installed openSLL from
    http://slproweb.com/products/Win32OpenSSL.html
    (OpenSSL-Win64 in my case )
    I copied
    alt text

    to demo1's build folder near the exe.
    (you can also add the path to Creator or maybe i just needed to reboot for it to find in c:\openSSL)

    in demo1 .pro file
    it says
    win32:CONFIG(release, debug|release): LIBS += -L$$SMTP_LIBRARY_LOCATION/release/ -lSMTPEmail
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$SMTP_LIBRARY_LOCATION/debug/ -lSMTPEmail

    so i added the DLL files to
    alt text

    note: debug OR release sub folder. match how you build the app.

    Then it ran.
    alt text

    However, google blocked my app and
    i had to login it and allow it.

    Then it lists the email in sent
    alt text



  • The programmer of simple-mail provided a fix, now it compiles fine. The only thing a had to do additionally was to install openSSL


Log in to reply