Welcome!

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

Reply
Developer
Posts: 101
Registered: ‎01-06-2014
My Device: Q10
My Carrier: EE
Accepted Solution

Email invoke not working

I'm trying to invoke email when I tap an action bar item but it doesn't work. Is something missing?:

import bb.cascades 1.2

NavigationPane {
	Page {
        actions: [
            ActionItem {
                id: action1
                title: "Tell a Friend"
                imageSource: "asset:///images/ic_email.png"
                ActionBar.placement: ActionBarPlacement.OnBar
                onTriggered: {
                    emailInvocation.query.uri = "subject=Useful travel app&body=Hello" + emailBody.text
                    emailInvocation.query.updateQuery();
                }
            }
        ]
        
	    titleBar: TitleBar {
	        title: "Welcome"
	    }
	    Container {

            }
        }
    }
    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);
            }
        }
    ]
}

 

Developer
Posts: 265
Registered: ‎01-02-2011
My Device: Z30, PlayBook
My Carrier: AT&T

Re: Email invoke not working

Did add the pim to the .pro file?

 

Maybe because you don't have the "mailto" portion of the query.

emailInvocation.query.uri = "mailto:emailtosend@somewhere.com?Useful travel app&body=Hello" + emailBody.text

 

_________________
Meetup for BlackBerry 10
Meetup Search Tool - not available at the moment
Developer
Posts: 101
Registered: ‎01-06-2014
My Device: Q10
My Carrier: EE

Re: Email invoke not working

Added it but, still nothing

Highlighted
Developer
Posts: 134
Registered: ‎02-24-2013
My Device: BlackBerry Z10 LE
My Carrier: Telcel

Re: Email invoke not working

[ Edited ]

You should use IvokeActionItem to use targets.

 

It should work:

 

InvokeActionItem {
                   ActionBar.placement: ActionBarPlacement.OnBar
                   query.invokeTargetId: "sys.pim.uib.email.hybridcomposer"
                   query.invokeActionId: "bb.action.SENDEMAIL"
                   query.mimeType: ""
                   query.uri: "mailto:youremail@email.com?subject=Your%subject%here"
                   query.invokerIncluded: true
                   imageSource: "asset:///images/msg.png"
                   title: "Contact Us"
                     }

 

Developer
Posts: 101
Registered: ‎01-06-2014
My Device: Q10
My Carrier: EE

Re: Email invoke not working

Thanks a lot mate it works

Developer
Posts: 134
Registered: ‎02-24-2013
My Device: BlackBerry Z10 LE
My Carrier: Telcel

Re: Email invoke not working

You're welcome.. Smiley Wink