0

I wanna send a simple email with Qt. I tried a lot of libraries but the one that I found the simplest was chilkat libraries. Here is my code...

CkMailMan mailman;

bool success = mailman.UnlockComponent("xxxxxxxxxxxxx");
    if (success != true) {
        qDebug() << mailman.lastErrorText() << "\r\n";
        return;
    }




mailman.put_SmtpHost("smtp.gmail.com");
mailman.put_SmtpUsername("xxxxxxxxxx@gmail.com");
mailman.put_SmtpPassword("xxxxxxxxxxxxxxxxxxx");


CkEmail email;
QString body = "xxxxxxxxxxxxxxxxxxxx";
QByteArray ba = body.toLatin1();
const char *c_str2 = ba.data();


email.put_Subject("xxxxxxxxxxxxxxxx");
email.put_Body(c_str2);
email.put_From("xxxxxxxxxxxxxx");

success = email.AddTo("xxxxxxxxxxx","xxxxxxxxxx@gmail.com");



success = mailman.SendEmail(email);
   if (success != true) {
       qDebug() << mailman.lastErrorText() << "\r\n";
       return;
   }

   success = mailman.CloseSmtpConnection();
      if (success != true) {
           qDebug() << "Connection to SMTP server not closed cleanly." << 
"\r\n";
       }

       qDebug() << "Mail Sent!" << "\r\n";

And here is the error...error: cannot find -lChilkatDbg_x64d

Edit: .pro file:

#-------------------------------------------------
#
# Project created by QtCreator 2017-05-20T16:57:12
#
#-------------------------------------------------

QT       += core gui network

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = WoW_Free_Gold
TEMPLATE = app


SOURCES += main.cpp\
    mainwindow.cpp \



HEADERS  += mainwindow.h \

FORMS    += mainwindow.ui

RESOURCES += \
    resources.qrc



win32:CONFIG(release, debug|release): LIBS += -L$$PWD/chilkat-9.5.0-x86_64-
vc2017/libs/ -lChilkatDbg_x64
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/chilkat-9.5.0-
x86_64-vc2017/libs/ -lChilkatDbg_x64d
else:unix: LIBS += -L$$PWD/chilkat-9.5.0-x86_64-vc2017/libs/ -
lChilkatDbg_x64

INCLUDEPATH += $$PWD/chilkat-9.5.0-x86_64-vc2017/include
DEPENDPATH += $$PWD/chilkat-9.5.0-x86_64-vc2017/include

DISTFILES += \
    chilkat-9.5.0-x86_64-vc2017/libs/ChilkatDbg_x64.lib \
    chilkat-9.5.0-x86_64-vc2017/libs/ChilkatDbgDll_x64.lib \
    chilkat-9.5.0-x86_64-vc2017/libs/ChilkatRel_x64.lib \
    chilkat-9.5.0-x86_64-vc2017/libs/ChilkatRelDll_x64.lib

How can I make this work ? Thanks all...

1 Answers1

0

Just in case you're using MinGW, you would use one of the top 3 libs listed here: https://www.chilkatsoft.com/downloads_mingw.asp

And for VC2010, you would choose either the 64-bit or 32-bit VC++ 10 libs at https://www.chilkatsoft.com/downloads_vcpp.asp#downloads

Chilkat Software
  • 1,405
  • 1
  • 9
  • 8