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: 121
Registered: ‎11-19-2008
My Device: Not Specified
Accepted Solution

Email Composer Not Working

I am trying to open the email composer from C++ and pre-load a simple message body in it. Here is the code that I am using but it doesn't work for some reason. It executes but nothing happens.

 

    bb::system::InvokeManager* m_invokeManager = new bb::system::InvokeManager(this);
    bb::system::InvokeRequest request;

    request.setTarget(QString("sys.pim.uib.email.hybridcomposer"));
    request.setAction(QString("bb.action.COMPOSE"));
    request.setMimeType(QString("message/rfc822"));
    QString message = QString("{\"body\" : \"Sent from my BB10\"}");
    request.setData(message.toUtf8());

    m_invokeManager->invoke(request);

 Does anybody have an idea of what I am doing wrong? Am i missing a permission or a library that needs to be added? I have LIBS += -lbbsystem in my .pro file.

 

I am using the Dev Alpha simulator and SDK 10.0

 

Developer
Posts: 230
Registered: ‎01-12-2013
My Device: z30
My Carrier: Mobile Vikings

Re: Email Composer Not Working

So it opens the e-mail task but it doesn't add the body? The code looks ok actually...

______________________________________________________
BB10-OAuth: GitHub
Developer
Posts: 121
Registered: ‎11-19-2008
My Device: Not Specified

Re: Email Composer Not Working

No, it actually doesn't work at all. The code above does absolutely nothing.

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Email Composer Not Working

I've tried to run this code on Dev Alpha running 10.9.10.35 and the Composer is shown but body isn't prepopulated.

I've added LIBS += -lbbsystem to .pro file.
Didn't add any permissions,

Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 121
Registered: ‎11-19-2008
My Device: Not Specified

Re: Email Composer Not Working


Zmey wrote:
I've tried to run this code on Dev Alpha running 10.9.10.35 and the Composer is shown but body isn't prepopulated.

I've added LIBS += -lbbsystem to .pro file.
Didn't add any permissions,

 Just to confirm, is that the physical Dev Alpha A or B or the simulator?

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Email Composer Not Working

Physical device. Dev Alpha A.

Andrey Fidrya, @zmeyc on twitter
Highlighted
Developer
Posts: 123
Registered: ‎01-11-2013
My Device: BlackBerry z10
My Carrier: Docomo

Re: Email Composer Not Working

I have same issue, I am trying to add "to" like below

 

var data = "{\"to\" : [\"info@adpolice.com\"]}";

 but it not working. email composer is opening but "to" data not passing to email composer..

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Email Composer Not Working

[ Edited ]

It seems JSON is not working currently. As a workaround these fields can be prepopulated by setting an URL:

 

request.setTarget(tr("sys.pim.uib.email.hybridcomposer"));
request.setAction(tr("bb.action.COMPOSE"));
request.setMimeType(tr("message/rfc822"));
request.setUri("mailto:address@domain.com?cc=address2@domain.com&bcc=address3@domain.com&subject=A%20Subject&body=That%20body");
bb::system::InvokeManager* m_invokeManager = new InvokeManager(this);
m_invokeManager->invoke(request);

I've checked that the code above works.

 

upd: the docs state that the action should be bb.action.OPEN or bb.action.SENDEMAIL when using the URL:http://developer.blackberry.com/cascades/documentation/device_platform/invocation/email.htmlI've also tried to comment out target, action and mimeType leaving only setUri and the composer is still invoked.

InvokeRequest request;
request.setUri("mailto:address@domain.com?cc=address2@domain.com&bcc=address3@domain.com&subject=A%20Subject&body=That%20body");
bb::system::InvokeManager* invokeManager = new InvokeManager(this);
invokeManager->invoke(request);

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: Email Composer Not Working

Hi Zmey, you solution works. Where did you find this solution? It is actually different from the document. Thank you.




p(^_^)q
Good good study, day day up
Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: Email Composer Not Working

Email composer may not work on the simulator but it does run properly on the device.




p(^_^)q
Good good study, day day up