PDA

View Full Version : how do i send message by ÙŽ QxtSmtp ??



alabdaly
12th July 2010, 08:41
hello...
i want to send message by libQxt but i dont know,i need to example . please help me.

wysota
12th July 2010, 08:58
Construct the mail message, optionally set the user and password, connect to smtp server, send the message and disconnect.

alabdaly
12th July 2010, 09:17
thank's
for example if i want to send mail from xxxxxx@xxxxxx.xxx to xxxxxx@gmail.com how i can do that??

wysota
12th July 2010, 09:29
You go to http://doc.libqxt.org/tip/qxtsmtp.html and read the documentation of the QxtSmtp class and find the methods names matching the directions I gave you in the previous post and use them.

alabdaly
12th July 2010, 10:45
Mail->setSender(From->text());
Mail->setSubject(Subject->text());
Mail->setBody(message->toPlainText());
Mail->addRecipient("mohammd.lbdl@gmail.com");
QHash<QString,QString> headers;
headers.insert("MIME-Version","1.0");
headers.insert("Content-type","text/html; charset=utf-8");
headers.insert("from","al-mhawer.com");
Mail->setExtraHeaders(headers);
smtp->connectToHost("gmail.com");
smtp->send(*Mail);

this code is work but not send mail why ??

tbscope
12th July 2010, 10:49
Your host is wrong.
Go to the google gmail help pages and find what their smtp server address is.

alabdaly
12th July 2010, 12:28
i succeeded ,thank tbscope and thank wysota .:D