QT email client using IMAP4



  • I am developing a QT program that will check for new mails from gmail and download them using IMAP4 protocol. I am unable to write a command to display the messages in my inbox. please help me. Here is a sample of my code.
    @ socket->connectToHostEncrypted("imap.gmail.com", 993);

    if(!socket->waitForConnected(50000)){
        qDebug()<<"Error:"<<socket->errorString();
    }
    

    }

    void MySocket::connected(){
    qDebug()<<"*\nconnected....\n";

    QByteArray byteArray("a001 LOGIN username password@");
    socket->write(byteArray);
    socket->write("\r\n");
    
    socket->waitForReadyRead();
    
    byteArray.clear();
    byteArray.append("A002 STARTTLS");
    socket->write(byteArray);
    socket->write("\r\n");
    

    }
    @


Log in to reply
 

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