Send a new email in Qt
hamishwillee
(Talk | contribs) m (Add messaging category) |
hamishwillee
(Talk | contribs) m (Hamishwillee - Added ArticleMetaDataTemplate) |
||
| Line 2: | Line 2: | ||
{{Abstract|visible=true|This code example shows how to send an email using the Qt Mobility [http://doc.qt.nokia.com/qtmobility-1.1/messaging.html messaging] API}}. | {{Abstract|visible=true|This code example shows how to send an email using the Qt Mobility [http://doc.qt.nokia.com/qtmobility-1.1/messaging.html messaging] API}}. | ||
| − | <code | + | {{ArticleMetaData |
| + | |sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] --> | ||
| + | |installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) --> | ||
| + | |devices= <!-- Devices tested against - e.g. ''devices=N95, N8'') --> | ||
| + | |sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) --> | ||
| + | |platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later --> | ||
| + | |devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) --> | ||
| + | |signing=<!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer --> | ||
| + | |capabilities=<!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. --> | ||
| + | |keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase --> | ||
| + | |creationdate=11 April 2011 | ||
| + | |author=[[User:talk2mks]] | ||
| + | |reviewer=<!-- Following technical re-review of article: [[User:username]] --> | ||
| + | |timestamp=<!-- Following technical re-review of article: YYYYMMDD --> | ||
| + | }} | ||
| + | <code cpp> | ||
//Create message service objects | //Create message service objects | ||
QMessageServiceAction* msgAction = new QMessageServiceAction ( this); | QMessageServiceAction* msgAction = new QMessageServiceAction ( this); | ||
Revision as of 05:16, 7 September 2011
This code example shows how to send an email using the Qt Mobility messaging API.
Article Metadata
//Create message service objects
QMessageServiceAction* msgAction = new QMessageServiceAction ( this);
// Create a new email
QMessage msg;
msg.setType(QMessage::Email);
// Add required parameters
msg.setTo (QMessageAddress("qt@forum.nokia.com",QMessageAddress::Email));
msg.setSubject("QT email example");
//Set message body
msg.setBody("This is test message!");
// Add Attachments
QStringList attachments;
attachments.append("abc.jpg");
msg.appendAttachments(paths);
//Send email message
msgAction->send(msg);

