BB 10 Cascades qml sending a simple email
blackberry-10, blackberry-cascades, qml
Solution
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:someemailadress@cookbook.xyz?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);
}
}
]
}
Problem
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.