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

Web and WebWorks Development

Reply
Developer
Posts: 39
Registered: ‎01-07-2009
My Device: Not Specified
Accepted Solution

Compose email with attachment BB10 - Invoke? Mailto?

I've been digging around trying to find the "current" best way to compose a new email from my WebWorks BBUI app.

 

I want to be able to display the BB10 email compose form, fill out the subject and attach a file to it. Then let the user further edit it before they press send.  

 

I've looked at the "share button" invoke sample, but that can't seem to do it.  In particular, if the type isn't text/plain (say image/*), I don't get many sharing options!

 

I've tried blackberry.invoke.MessageArguments but that appears to be for pre-BB10.

Invoking email directly didn't work.

var request = {
		action: 'bb-action.SHARE',
		type: 'text/plain',
		key: 'sys.pim.uib.email.hybridcomposer',
		data: 'test',
		target_type:['APPLICATION','CARD'] };

	blackberry.invoke.invoke(request, function(response) {console.log('ok:' +response);}, function() {console.log('failed');});

 Do I need to use a mailto: ?

 If so, what's the best way to invoke a mailto: from a button in BBUI/WebWorks?  I don't want to use a link.

 

Thanks for any insight here.

 

Retired
Posts: 245
Registered: ‎09-21-2012
My Device: Q10
My Carrier: Virgin

Re: Compose email with attachment BB10 - Invoke? Mailto?

You can invoke this through one of the webworks wrappers on the Card itself. The documentation is found here:

- http://developer.blackberry.com/html5/apis/blackberry.invoke.card.html#.invokeEmailComposer

 

You can follow the sample but I've pasted it here for convenience:

 

blackberry.invoke.card.invokeEmailComposer({
    subject: "Email subject",
    body: "Email body",
    to: ["a@a.ca", "b@b.com"],
    cc: ["c@c.ca, d@d.com"],
    attachment: ["/path/to/an/attachment.txt", "path/to/another/attachment.txt"]
}, function (done) {
    console.log(done);
}, function (cancel) {
    console.log(cancel)
}, function (invokeError) {
    console.log(invokeError);
});
@erikjohnzon
erjohnson@blackberry.com
Highlighted
Developer
Posts: 39
Registered: ‎01-07-2009
My Device: Not Specified

Re: Compose email with attachment BB10 - Invoke? Mailto?

Super. Thanks Erik, not sure how I missed tat one!