patrik08
27th May 2006, 21:17
I have a smtp auth connection and is ready to read qt4...
now i send
1- ehlo localhost
-------server
250-remote.com
250-STARTTLS
250-PIPELINING
250-8BITMIME
250-SIZE 0
250 AUTH LOGIN PLAIN CRAM-MD5
-------server
2- auth user@domaine.com
3- 334 VXNlcm5hbWU6
-------server
235 authentication finished successfully
-------server
4- mail from: user@domaine.com
Data .....
and wait...
-------server
221 Bye
-------server
..... How to create a CRAM-MD5 password on QT?
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();
}
}
}
now i send
1- ehlo localhost
-------server
250-remote.com
250-STARTTLS
250-PIPELINING
250-8BITMIME
250-SIZE 0
250 AUTH LOGIN PLAIN CRAM-MD5
-------server
2- auth user@domaine.com
3- 334 VXNlcm5hbWU6
-------server
235 authentication finished successfully
-------server
4- mail from: user@domaine.com
Data .....
and wait...
-------server
221 Bye
-------server
..... How to create a CRAM-MD5 password on QT?
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();
}
}
}