How to invoke Default Email Client on Symbian based Devices using Qt API?
Email:
There may be two ways to send mail.
1) Using QtMobility API
2) Using Defualt EMail Client
[B]Code using QtMobility [/B]
//Headers
#include <QMessage>
#include <QMessageService>
.pro will contain -> MOBILITY += messaging
// Actual Code
QMessageService* msgAction = new QMessageService(this);
QMessage msg;
msg.setType(QMessage::Email);
msg.setTo(QMessageAddress(QMessageAddress::Email,"narendardiscover@gmail.com"));
msg.setSubject("Test Subject");
msg.setBody("Welcome to Home");
QStringList attachments;
attachments.append(":/res/icon.png");
msg.appendAttachments(attachments);
//Send email message
qDebug()<<"Sending Status = "<<msgAction->send(msg);
[B]Code using Default Email Client[/B]
//Headers
#include <QDesktopServices>
#include <QUrl>
//Actual Code
QDesktopServices::openUrl(QUrl(tr("mailto:narendardiscover@gmail?subject=Test Subject&body=Welcome to Home")));
// Capability used for both ways
Symbian:TARGET.CAPABILITY += NetworkServices
Re: How to invoke Default Email Client on Symbian based Devices using Qt API?
I am interested in this as well. How can I send an email with an [B]attachment[/B] using the default email client. I mean something like
[code]
QDesktopServices:penUrl(QUrl(tr("mailto:narendardiscover@gmail?subject=Test Subject&body=Welcome to Home&attachement=c:\sampleimage.jpg")));
[/code]
Re: How to invoke Default Email Client on Symbian based Devices using Qt API?
[QUOTE=pixsta;910201]I am interested in this as well. How can I send an email with an [B]attachment[/B] using the default email client. I mean something like
[code]
QDesktopServices:penUrl(QUrl(tr("mailto:narendardiscover@gmail?subject=Test Subject&body=Welcome to Home&attachement=c:\sampleimage.jpg")));
[/code][/QUOTE]
You can do it wih QDesktopServices:: openUrl (), but you add the attachment with attach field, not attachment.
And of course you use double backslashes and most likely don't tr the whole URL...