Seite 1 von 1

[Solved] QTcpSocket / CRAM-MD5 password Problem...

Verfasst: 27. Mai 2006 21:40
von patrik08
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?

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();
                }
        }
}


Verfasst: 28. Mai 2006 01:56
von patrik08
Will jemand wissen wie mail senden mit
250 AUTH LOGIN PLAIN CRAM-MD5 ? :idea:

Verfasst: 28. Mai 2006 13:53
von FlorianBecker
geht?

Ja, schreibe es doch unter http://www.qtforum.de/forum/viewforum.php?f=7 in das Snippets, Tipps & Tricks Forum.

Verfasst: 28. Mai 2006 14:18
von patrik08
Es sendet auf jedem fall die mail raus... mit qmail & postfix server
mit Auth Password....
so kann mann von jedem provider senden....

es ist unter http://svn.sourceforge.net/viewcvs.cgi/ ... xslt/smtp/

Code: Alles auswählen

/*
USAGE!
      Smtp *newMail  = new Smtp("from@address.com","to@address.com"," Your Subject","My body text");
      class emit ErrorCloseAll() / SuccessQuit()   or get QStringList ErrorMSG; to read error and data....
*/


nur dass datum bekomme ich nicht richtig Ihn... +0200
GMT date oder sowas ... wenn man +0100 schreib ist es im mail postfach ganz oben.....

Auf jedem fall ist es nicht wie die janky spam mail im 1970....

Code: Alles auswählen

QString Smtp::TimeStampMail()
{
    /* Date: Mon, 08 May 2006 17:57:52 +0200 */
    /* Date: Sun, 28 May 2006 06:32:25 -0420 */
    QDateTime dt = QDateTime::currentDateTime();
    QDate timecute;
    QString day_en = timecute.shortDayName(timecute.day());
    QString month_en = timecute.shortMonthName (timecute.month());
    QString last = dt.toString("yyyy hh:mm:ss"); 
    QString maildate = QString( "Date: %1, %2 %3 %4 +0200" ).arg( day_en , QString::number(timecute.day()), month_en ,   last );
return maildate;
}