[Solved]SMTP Authentification
-
Hi
I have tried this prj in my app but I don't get it to work properly
""smtpclient": https://github.com/bluetiger9/SmtpClient-for-Qt":I dont. get the mail to be sent in that code,
Then I have an other code to send mail via SMTP and the main part looks like this
@SmtpClient::SmtpClient( const QString &from, const QString &to, const QString &subject, const QString &body )
{
socket = new QTcpSocket( this );
connect( socket, SIGNAL(readyRead()), this, SLOT( readyRead() ) );connect( socket, SIGNAL( connected() ), this, SLOT( connected() ) );
connect( socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
SLOT(errorReceived(QAbstractSocket::SocketError)));
connect( socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this,
SLOT(stateChanged(QAbstractSocket::SocketState)));
connect(socket, SIGNAL(disconnected()), this,
SLOT(disconnected()));;message = "To: " + to + "\n";
message.append("From: " + from + "\n");
message.append("Subject: " + subject + "\n");
message.append("\r\n" + body);
message.append(body);
message.replace( QString::fromLatin1( "\n" ), QString::fromLatin1( "\r\n" ) );
message.replace( QString::fromLatin1( "\r\n.\r\n" ),QString::fromLatin1( "\r\n..\r\n" ) );
this->from = from;
rcpt = to;
state = Init;
//this->Maddress = to.mid( to.indexOf('@',1)+1);//QString s= "smtp.";
//s.append(this->Maddress);
socket->connectToHost( "192.168.100.1" , 25);if(socket->waitForConnected ( 40000 )) {qDebug("connected"); }
t = new QTextStream( socket );
}@
and so on......But in this code I'm not sure how to set Authentification to the mailserver when so is needed:
Is there a simpler way to solve this problem with smtp and mail in qt.
I have been looking around but I always end up with this two examples -
Take a look "here":http://libqxt.bitbucket.org/doc/0.6/qxtsmtp.html
-
Looks OK
Have you used it. -
No, I haven't, but LibQxt extension is not bad at all, should actually work.
-
Worked perfect for me.
-
Hello,
socket = new QSslSocket(this);
this line generate a error like "Illegal Instruction";
i use qt4.6.3 version for ARM baord please help me