Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

https://developer.blackberry.com/cascades/documentation/device_platform/pim/messages.html

Any help would be appreciated.

like image 328
user1158745 Avatar asked Jan 29 '13 21:01

user1158745


1 Answers

Following code will open a sheet with email composer having all the specified email fields prepopulated:

import bb.cascades 1.0

Page {
    Container {
        horizontalAlignment: HorizontalAlignment.Fill
        layout: DockLayout {
        }

        Container {
            horizontalAlignment: HorizontalAlignment.Center
            verticalAlignment: VerticalAlignment.Center
            TextArea {
                id: emailBody
            }
            Button {
                text: "Send email"
                onClicked: {
                    emailInvocation.query.uri = "mailto:[email protected]?subject=Test&body=" + emailBody.text
                    emailInvocation.query.updateQuery();
                }
            }
        }
    }

    attachedObjects: [
        Invocation {
            id: emailInvocation
            query.mimeType: "text/plain"
            query.invokeTargetId: "sys.pim.uib.email.hybridcomposer"
            query.invokeActionId: "bb.action.SENDEMAIL"
            onArmed: {
                emailInvocation.trigger(emailInvocation.query.invokeActionId);
            }
        }
    ]
}
like image 111
Sunseeker Avatar answered Nov 18 '22 23:11

Sunseeker