title: QT email client using IMAP4
body: <p>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.</p>
  
  <pre><code>    socket-&gt;connectToHostEncrypted("imap.gmail.com", 993);
  
      if(!socket-&gt;waitForConnected(50000)){
          qDebug()&lt;&lt;"Error:"&lt;&lt;socket-&gt;errorString();
      }
  }
  
  void MySocket::connected(){
      qDebug()&lt;&lt;"**********\nconnected....\n*********";
  
      QByteArray byteArray("a001 LOGIN username password");
      socket-&gt;write(byteArray);
      socket-&gt;write("\r\n");
  
      socket-&gt;waitForReadyRead();
  
      byteArray.clear();
      byteArray.append("A002 LIST inbox");
      socket-&gt;write(byteArray);
      socket-&gt;write("\r\n");
  
  }
  </code></pre>