Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 18
Registered: ‎05-15-2013
My Device: 9700
My Carrier: 919909743132

BB 10 Cascades qml sending a simple email

I found one example in the the git hub for BB 10 for sending an email, but it looks pretty complicated and alot done in C.

does anyone have an example on how to send a quick email using QML. I don't need any buttons or text fields, just hard coded values.

I found this simple snip, but dont' know how to integrate it.


Any help would be appreciated.

Posts: 34
Registered: ‎05-02-2013
My Device: 9700
My Carrier: Idea

Re: BB 10 Cascades qml sending a simple email

in main.cpp after creating your QmlDocument, qml->setContextProperty("yourshortcut", object);

if(reply) {
QObject::connect(reply, SIGNAL(finished()),this, SLOT(onInvokeResult()));
_invokeTargetReply = reply;
delete reply;

void xxx:Smiley SurprisednInvokeResult()
// Check for errors
switch(_invokeTargetReply->error()) {
// Invocation could not find the target
// did we use the right target ID?
case InvokeReplyError::NoTarget: {
qDebug() << "invokeFinished(): Error: no target" << endl;
// There was a problem with the invoke request
// did we set all the values correctly?
case InvokeReplyError::BadRequest: {
qDebug() << "invokeFinished(): Error: bad request" << endl;
// Something went completely
// wrong inside the invocation request
// Find an alternate route Smiley Sad
case InvokeReplyError::Internal: {
qDebug() << "invokeFinished(): Error: internal" << endl;
//Message received if the invoke request is successful
qDebug() << "invokeFinished(): Invoke Succeeded" << endl;

// A little house keeping never hurts...
delete _invokeTargetReply;

Then in QML call the C++ function invokeEmail using the shortcut you created with the context property. I use this to invoke the email card
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: BB 10 Cascades qml sending a simple email

This is not the BB10 forum,  Please post BB10 questions and response here:


Posts: 144
Registered: ‎12-18-2010
My Device: Limited Edition Z10 & Blackberry Playbook
My Carrier: Rogers Wireless

Re: BB 10 Cascades qml sending a simple email

Here is how I am doing it from QML in my applications


Menu.definition: MenuDefinition {
        // Add a Help action
        helpAction: HelpActionItem {
            attachedObjects: [
                Invocation {
                    id: invoke
                    query {
                        //id: invokeQuery
                        uri: "mailto:address@domain.com?subject=Insert%20Subject"
                        invokeActionId: "bb.action.SENDEMAIL"
                        invokeTargetId: "sys.pim.uib.email.hybridcomposer"
            onTriggered: {


In my apps, the above snippet is part of a menu item.  When the menu item is clicked, or triggered, it opens the e-mail composer nad populates the To field and the Subject.  The user can then input the body text and click on send.


see documentation https://developer.blackberry.com/cascades/documentation/device_platform/invocation/email.html for other examples of ways to invoke the E-mail application.

Playbook Apps:
Touch Painter, LinkShrink

BB10 Apps:
NoteToSelf , LinkShrink
Posts: 17
Registered: ‎04-09-2013
My Device: developer
My Carrier: kpn

Re: BB 10 Cascades qml sending a simple email

Even faster is using html in a label in QML:


Label {
              text: "<html><a href='mailto: mail@mail.com'>mail@mail.com</a></html>"
              textFormat: TextFormat.Html



This example is easy but limited. Best way is the invocation framework as described in the above post.