[SOLVED]Invoke External e-mail and set HTML content
-
Hi,
did you look at the "messaging API":http://doc.qt.nokia.com/qtmobility-1.2/messaging.html of QtMobility?
-
As Gerolf said you should use Qt Mobility. Key classes for your case are "QMessage":http://doc.qt.nokia.com/qtmobility/qmessage.html and "QMessageService":http://doc.qt.nokia.com/qtmobility/qmessageservice.html. Method "compose":http://doc.qt.nokia.com/qtmobility/qmessageservice.html#compose will open the default composer application using message as a prototype. Example:
@
QMessageService* pMessageManager = new QMessageService(this);
QMessage message;
message.setType(QMessage::Email);
message.setBody("your message");
pMessageManager->compose(message);
@Btw using the same approach you can open the default app for SMS or MMS (of course it works on both Symbian and MeeGo devices).
-
I have found this method and run... wath do you think?
@DesktopServices::openUrl(QUrl("mailto:user@foo.com?subject=Test&body=Just a test"))@
-
[quote author="Vetryaspa" date="1331303594"]I have found this method and run... wath do you think?
@DesktopServices::openUrl(QUrl("mailto:user@foo.com?subject=Test&body=Just a test"))@[/quote]
In my opinion even if this works it would be much better to use the standard solution with Qt Mobility QMessage and QMessageService which I recommended in my previous post.
-
[quote author="Vetryaspa" date="1331304023"]ok!! if i would sand messag in HTML format how i can do it? because the bady was not formatted in HTML even if i insert some HTML code[/quote]
The official documentation includes an "example how to compose e-mail with HTML content":http://doc.qt.nokia.com/qtmobility/serviceactions.html.
-
[quote author="leon.anavi" date="1331304383"]
[quote author="Vetryaspa" date="1331304023"]ok!! if i would sand messag in HTML format how i can do it? because the bady was not formatted in HTML even if i insert some HTML code[/quote]The official documentation includes an "example how to compose e-mail with HTML content":http://doc.qt.nokia.com/qtmobility/serviceactions.html.
[/quote]this code not run, where is the probelm?
@ QString testo;
testo.append("<HTML CONTENT TEXT>"); QMessageService* pMessageManager = new QMessageService(this); QMessage message; message.setType(QMessage::Email); message.setSubject(rist->value("NOME_RISTORANTE")); QString htmlBody("<html><head></head><body>%1</body></html>"); message.setBody(htmlBody.arg(testo),"text/html"); pMessageManager->compose(message);@
Why not run?
-
@
QDesktopServices::openUrl(QUrl("mailto:user@foo.com?subject=Test&body=Just a test"))
@
Some times ago I used this to open my default mail client and I think it's not so bad...