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

Adobe AIR Development

Reply
New Member
cllera
Posts: 1
Registered: ‎06-18-2013
My Device: Z10
My Carrier: None

Email invocation with prepopulated fields

Hello!

 

I'm trying to use the invoke framework to open an email composer with prepopulated fields (to, from, cc, bcc, etc.), but an empty email composer is always openend instead. I'm following the example available in the Adobe AIR documentation for BlackBerry 10: http://developer.blackberry.com/air/documentation/bb10/email.html#ufa1355425510139

 

This is the invocation code:

 

// Request object
var request:InvokeRequest = new InvokeRequest;
request.target = "sys.pim.uib.email.hybridcomposer";
request.action = "bb.action.COMPOSE";
request.mimeType = "message/rfc822";
			
// Sent data JSON
var sentData:Object = new Object;
sentData.to = ["a@a.com"];
sentData.from = 1234;
sentData.cc = ["b@b.com"];
sentData.bcc = ["c@c.com"];
sentData.subject = "Subject";
sentData.body = "Body";
sentData.attachment = ["file:///path/to/file.txt"];
			
var sentDataStr:String = JSON.stringify(sentData);
			
var requestData:ByteArray = new ByteArray;
requestData.writeMultiByte(sentDataStr, "iso-8859-1");
requestData.position = 0;
			
			request.data = requestData;
			
// Invoke manager
InvokeManager.invokeManager.addEventListener(InvokeEvent.INVOKE_TARGET, onEmailInvokeTarget);
InvokeManager.invokeManager.addEventListener(ErrorEvent.ERROR, onEmailInvokeError);
			
InvokeManager.invokeManager.invoke(request);

 

Can you please help me?

 

Thank you very much!

Please use plain text.
Developer
Developer
mdd
Posts: 222
Registered: ‎01-17-2012
My Device: PB
My Carrier: ATT

Re: Email invocation with prepopulated fields

any solution found?

 

I am using 10.2 (simulator) and SDK 3.2.1 and still not working for me...

 

Regards,

Please use plain text.
BlackBerry Development Advisor
jdolce
Posts: 172
Registered: ‎10-25-2010
My Device: Not Specified

Re: Email invocation with prepopulated fields

I am not sure why that doesn't work, but this does.

 

var request:InvokeRequest = new InvokeRequest();
request.target = "sys.pim.uib.email.hybridcomposer";
request.action = "bb.action.SENDEMAIL";
request.uri="mailto:address@domain.com?cc=address2@domain.com&bcc=address3@domain.com&subject=A%20Subject&body=That%20body";
		
// Invoke manager
InvokeManager.invokeManager.addEventListener(InvokeEvent.INVOKE_TARGET, onEmailInvokeTarget);
InvokeManager.invokeManager.addEventListener(ErrorEvent.ERROR, onEmailInvokeError);
InvokeManager.invokeManager.invoke(request);

 

Please use plain text.