Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Send mail
Forum Updated to NodeBB v4.3 + New Features

Send mail

Scheduled Pinned Locked Moved 3rd Party Software
qxt
25 Posts 3 Posters 11.8k Views 2 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.
  • Y Offline
    Y Offline
    Yacinoben
    wrote on last edited by Yacinoben
    #3

    I used git clone https://bitbucket.org/libqxt/libqxt.git for download source code,

    I run this commands :

    -configure.bat
    -configure -debug_and_release
    -mingw32-make
    -mingw32-make install

    it's works

    but when i compile, i get a message for dynamic links :

    _imp___ZN7QxtSmtpC1EP7QObject ...

    .pro :

    QT+= network
    QXT+= core gui 
    
    LIBS+=-LB:/etudes/Programmationastuce/Qt/Bibliotheque/libqxt/lib/ -lQxtCore
    INCLUDEPATH += B:/etudes/Programmationastuce/Qt/Bibliotheque/libqxt/include/QxtCore \
                   B:/etudes/Programmationastuce/Qt/Bibliotheque/libqxt/include/QxtNetwork 
               
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      QxtSmtp is is the network module of Qxt not of Qt.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        Yacinoben
        wrote on last edited by Yacinoben
        #5

        Same error.
        After mingw32-make install

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #6

          Doesn0t look like the same thing. You seem to have errors with Qxt itself or am I misunderstanding ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Y Offline
            Y Offline
            Yacinoben
            wrote on last edited by
            #7

            Yes, I have a problem with Qxt, I included the path in variable environments

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #8

              Did you check the pull request to make it buildable with Qt 5 ?

              If not the most simple course of action (and the one the folks behind the library suggests) is to copy the sources of the classes you need in your project.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • Y Offline
                Y Offline
                Yacinoben
                wrote on last edited by Yacinoben
                #9

                I remove all files except qxtglobal., qxtmailmessage, qxtmailattachment .h and .cpp

                i get same error :
                alt text

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  I didn't suggest to delete anything in libqxt.

                  What I suggested, based on what the authors of the library wrote, is that you copy the files you need inside your project and build them as part of your project.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    MajidKamali
                    wrote on last edited by
                    #11

                    Check this:
                    https://github.com/dbzhang800/QtMail

                    1 Reply Last reply
                    0
                    • Y Offline
                      Y Offline
                      Yacinoben
                      wrote on last edited by
                      #12

                      @SGaist Doesn't work, with compile
                      alt text

                      and with copy direct in my project, I get a problem with an old version of Qt

                      @MajidKamali

                      alt text

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #13

                        What does the .pro file of your test project look like ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • Y Offline
                          Y Offline
                          Yacinoben
                          wrote on last edited by Yacinoben
                          #14

                          alt text

                          i tried in ubuntu, but always error

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #15
                            TEMPLATE = app
                            TARGET = test_email
                            INCLUDEPATH += .
                            QT += network
                            # Input
                            HEADERS += qxtglobal.h \
                                       qxtmail_p.h \
                                       qxtmailattachment.h \
                                       qxtmailmessage.h \
                                       qxtsmtp.h \
                                       qxtsmtp_p.h \
                                       qxthmac.h
                            SOURCES += main.cpp \
                                       qxtglobal.cpp \
                                       qxtmailattachment.cpp \
                                       qxtmailmessage.cpp \
                                       qxtsmtp.cpp \
                                       qxthmac.cpp
                            

                            Is what I have and it's building except I needed to add a forward declaration for QIODevice in qxtmailattachement.h

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            1
                            • Y Offline
                              Y Offline
                              Yacinoben
                              wrote on last edited by Yacinoben
                              #16

                              I copied direct, no make , same error in release and debug mode
                              alt text

                              But why i get this message after execution of mingw32-make ?

                              alt text

                              I followed this guide https://bitbucket.org/libqxt/libqxt/wiki/user_guidet

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #17

                                Did you do a clean rebuild ?

                                As for the second error, you took the original sources which were written for Qt 4. There has been some changes with Qt 5 so if you want to build Qxt with Qt 5. As I wrote before, you should at least take a look at the pull request related to that.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                1
                                • Y Offline
                                  Y Offline
                                  Yacinoben
                                  wrote on last edited by Yacinoben
                                  #18

                                  Thaaank, it finally compile, I take the pull request, and i add a #include <QIODevice> in file QxtMailAttachement.h .

                                  but he remain a last problem .

                                  .pro

                                  TEMPLATE = app
                                  TARGET = test_email
                                  
                                  
                                  CONFIG  += qxt
                                  QXT += core
                                  QT += network
                                  # Input
                                  SOURCES += main.cpp 
                                  INCLUDEPATH+= C:/Qxt/include
                                  LIBS+= -LC:/Qxt/bin -lQxtCored -lQxtNetworkd -lQxtSqld -lQxtWebd -lQxtWidgetsd
                                  
                                  

                                  main.cpp

                                  #include <QtCore>
                                  #include <QtGui>
                                  #include <QxtMailMessage>
                                  #include <QxtSmtp>
                                  #include <QtNetwork>
                                   
                                   
                                  int main(int argc, char *argv[])
                                  {
                                      QCoreApplication a(argc, argv);
                                   
                                      QxtMailMessage message;
                                      message.setSender("Ken31@gmail.com");
                                      message.addRecipient("Ken31@gmail.com");
                                      message.setSubject("Alarm");
                                      message.setBody("Alarm message.");
                                   
                                      QxtSmtp smtp;
                                      a.connect(&smtp, SIGNAL(mailSent(int)), SLOT(quit()));
                                      smtp.setUsername("Ken31@gmail.com");
                                      smtp.setPassword("password");
                                      smtp.connectToSecureHost("smtp.gmail.com");
                                      smtp.send(message);
                                   
                                      return a.exec();
                                  }
                                  

                                  I wanted to send an email, but it does not send, and same problem with hotmail.

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #19

                                    You should add some error handling, there are several things that could go wrong.

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    1
                                    • Y Offline
                                      Y Offline
                                      Yacinoben
                                      wrote on last edited by
                                      #20
                                      
                                      testSmtp::testSmtp(QWidget *parent) : QWidget(parent)
                                      {
                                      
                                            QxtMailMessage *message =new QxtMailMessage;;
                                            message->setSender("Ken31@gmail.com");
                                            message->addRecipient("Ken31@gmail.com");
                                            message->setSubject("Alarm");
                                            message->setBody("Alarm message.");
                                      
                                            QxtSmtp *smtp= new QxtSmtp(this);
                                      
                                            smtp->setUsername("Ken31@gmail.com");
                                            smtp->setPassword("passwordGmail");
                                            smtp->connectToSecureHost("smtp.gmail.com");
                                            smtp->send(*message);
                                      
                                             connect(smtp, SIGNAL(mailSent(int)), this, SLOT(mailSent(int)));
                                             connect(smtp, SIGNAL(mailFailed(int,int,QByteArray)), this, SLOT(mailFailed(int,int,QByteArray)));
                                             connect(smtp, SIGNAL(recipientRejected(int,QString,QByteArray)), this, SLOT(recipientRejected(int,QString,QByteArray)));
                                             connect(smtp, SIGNAL(senderRejected(int,QString,QByteArray)), this, SLOT(senderRejected(int,QString,QByteArray)));
                                             connect(smtp, SIGNAL(connected()), this, SLOT(connected()));
                                             connect(smtp, SIGNAL(connectionFailed(QByteArray)), this, SLOT(connectionFailed(QByteArray)));
                                             connect(smtp, SIGNAL(authenticated()), this, SLOT(authenticated()));
                                             connect(smtp, SIGNAL(authenticationFailed(QByteArray)), this, SLOT(authenticationFailed(QByteArray)));
                                             connect(smtp, SIGNAL(finished()), this, SIGNAL(finished()));
                                      
                                      void testSmtp::mailSent(int mailID){
                                          qDebug() << mailID << true;
                                          emit finished(mailID, true);
                                      }
                                      
                                      void testSmtp::mailFailed(int mailID, int, const QByteArray & msg){
                                          emit finished(mailID, false);
                                          emit erreur(QString::number(mailID) + " mailFailed " + msg, __LINE__);
                                      }
                                      
                                      void testSmtp::recipientRejected(int mailID, const QString& address, const QByteArray & msg  ){
                                          emit erreur(QString::number(mailID) + "recipientRejected " + address + " " + msg, __LINE__);
                                      }
                                      
                                      void testSmtp::senderRejected(int mailID, const QString& address, const QByteArray & msg  ){
                                          emit erreur(QString::number(mailID) + "senderRejected " + address + " " + msg, __LINE__);
                                      }
                                      
                                      void testSmtp::connected(){
                                          if(QCoreApplication::arguments().contains("dvp"))
                                              qDebug() << "connected";
                                      }
                                      
                                      void testSmtp::connectionFailed( const QByteArray & msg ){
                                          emit erreur("connectionFailed " + msg, __LINE__);
                                          finished();
                                      }
                                      
                                      void testSmtp::authenticated(){
                                          if(QCoreApplication::arguments().contains("dvp"))
                                              qDebug() << "authenticated";
                                      }
                                      
                                      void testSmtp::authenticationFailed( const QByteArray & msg ){
                                          emit erreur("authenticationFailed " + msg, __LINE__);
                                          finished();
                                      }
                                      
                                      

                                      testSmtp.h

                                      class testSmtp : public QWidget
                                      {
                                          Q_OBJECT
                                      public:
                                          explicit testSmtp(QWidget *parent = 0);
                                      
                                      signals:
                                      
                                      public slots:
                                      
                                      
                                      
                                          void mailSent(int mailID);
                                           void mailFailed(int mailID, int, const QByteArray & msg);
                                      
                                           void recipientRejected(int mailID, const QString & address, const QByteArray & msg );
                                           void senderRejected(int mailID, const QString & address, const QByteArray & msg );
                                      
                                           void connected();
                                           void connectionFailed( const QByteArray & msg );
                                           void authenticated();
                                           void authenticationFailed( const QByteArray & msg );
                                      
                                      signals:
                                          void finished();
                                          void finished(int id, bool result);
                                      
                                          void erreur(QString text, int no_ligne);
                                      };
                                      

                                      i have no error . but it doesn't send

                                      1 Reply Last reply
                                      0
                                      • SGaistS Offline
                                        SGaistS Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #21

                                        Don't send the message before connecting all the signals.

                                        Add a button and in the slot connected to its clicked signal, create and send the message.

                                        Interested in AI ? www.idiap.ch
                                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        1 Reply Last reply
                                        0
                                        • Y Offline
                                          Y Offline
                                          Yacinoben
                                          wrote on last edited by
                                          #22

                                          I tried, but always Nothing, when i click in button, no message error .

                                           QPushButton *button = new QPushButton("Send",this);
                                                QxtMailMessage *message =new QxtMailMessage;;
                                                QxtSmtp *smtp= new QxtSmtp(this);
                                                smtp->setUsername("Ken31@gmail.com");
                                                smtp->setPassword("password");
                                                smtp->connectToSecureHost("smtp.gmail.com");
                                          
                                             connect(button,&QPushButton::pressed,this,[smtp,message]{
                                                     message->setSender("Ken31@gmail.com");
                                                     message->addRecipient("Ken31@gmail.com");
                                                     message->setSubject("Alarm");
                                                     message->setBody("Alarm message.");
                                                     smtp->send(*message);});
                                          
                                          /*other signal*/
                                          

                                          I also tried to write functions of QXtSmtp in the slot lamba-function but nothing

                                          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