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

Posts: 61
Registered: ‎10-16-2013
My Device: Z10
Accepted Solution

Email not getting send

I need to send an email through my application, silently without user interaction.

The example mentioned here 


does not help, for MessageBuilder does not have a default constructor.

it has a static method create, that needs an account ID.

i'm unable to gather inputs to retrive this account ID for email.

as mentioned here


using a default account gives the account ID as -1 and dint help either. 

Need to find the valid account ID for email accounts.

Please help!!

Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Email not getting send

Welcome to the forums.


I'm not sure this is possible, you could interact with a server for silent emailing?

If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Posts: 61
Registered: ‎10-16-2013
My Device: Z10

Re: Email not getting send

I'm not sure i m getting your answer, what i ment to say was :

MessageBuilder* _builder = (MessageBuilder::create(_accountID));

I'm unable to get the '_accountID' for email account, like for sms-mms we would provide,


QList<Account> account_list = _accountService->accounts(Service::Messages, "sms-mms");

// save its internal ID value for future API calls
_smsAccountId = account_list.first().id();


I want to do the same for Email messages.


Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30

Re: Email not getting send

You should be able to get a default account if one is set up (is there an email account on the device you tested with?), but you could also go through the list of accounts returned from accountService::accounts (Service::Typeservice) and pick the one you want.

Paul Bernhardt
Application Development Consultant

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Posts: 61
Registered: ‎10-16-2013
My Device: Z10

Re: Email not getting send

Set the default account on the device, and it worked :smileyvery-happy:

Thanks a tonn!! :smileyvery-happy: