[Solved] QTcpSocket / CRAM-MD5 password Problem...
Verfasst: 27. Mai 2006 21:40
Wenn man hoft das QTcpSocket viel signale von sich gibt so wie .... readyRead so irrt man sich gewaltig...
Nun ich kann lesen auf dem port 25 ... und habe alle signale mit emit plaziert ... nun wie kann qt4 ein CRAM-MD5 password generieren?....
zum senden?
Nun ich kann lesen auf dem port 25 ... und habe alle signale mit emit plaziert ... nun wie kann qt4 ein CRAM-MD5 password generieren?....
zum senden?
Code: Alles auswählen
Smtp::Smtp( const QString &from, const QString &to, const QString &subject, const QString &body )
{
const QString smtphost = "ppk.go";
const int Timeout = 5 * 1000;
linesend = 0;
qDebug() << "### Launch mail compose.... " << from << to << subject << body;
qDebug() << "### Config server smtp connect to...... " << smtphost;
smtpsocket = new QTcpSocket(this);
connect( this, SIGNAL(ConnectorSuccess()), this ,SLOT(ReadLiner()));
connect( this, SIGNAL(SendLine()), this ,SLOT(PutSendLine()));
smtpsocket->connectToHost(smtphost,25);
if (smtpsocket->waitForConnected(Timeout)) {
qDebug() <<"### connected on " << smtphost;
if (smtpsocket->waitForReadyRead(Timeout)) {
qDebug() <<"### emit from waitForReadyRead connect go can read";
emit ConnectorSuccess();
}
}
}
void Smtp::ReadLiner()
{
qDebug() << "### socketType = " << smtpsocket->socketType();
qDebug() << "### ReadLiner is start by textstream ";
t = new QTextStream( smtpsocket );
int loops = 0;
while (!t->atEnd()) {
loops++;
response = t->readLine();
qDebug() << loops << " in line " << response;
}
if (response.size() > 0) {
RemoteServerName = response;
mailstatus = response.left(3);
qDebug() << "###Status=" << mailstatus;
if (mailstatus == "220") {
linesend = 1;
emit SendLine();
}
}
}