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
New Contributor
Posts: 3
Registered: ‎01-17-2013
My Device: BB10 Alpha Dev B

Send email is getting failed... on personal side

I am getting the below error...

Curl Easy perform
Curl Easy GetInfo response code
Curl easy getInfo content_length_download
Curl Error Code 0
Response Code 200
Account id : 199
Message : ""
PIMCoreAccessPool::getPca 0 Thread Id 0x1
PIMCoreAccessPool::getPca a new PimAccess 0
Form Data bcc=%5B%22%5C%22Test%20Act3%5C%22%20%3CTestAct3%40hotmail.com%3E%22%5D&body=Testing%20email%20body&body_content_type=text%2Fplain%3B%20charset%3Dutf-8&cc=%5B%22%5C%22Test%20Act2%5C%22%20%3CTestAct2%40yahoo.com%3E%22%5D&encoding_action=0&encoding_type=0&options=%7B%22flagged%22%3Afalse%2C%22priority%22%3A%221%22%7D&subject=Test%20Subject%20&to=%5B%22%5C%22rajesh.allagi%40accenture.com%5C%22%20%3Crajesh.allagi%40accenture.com%3E%22%5D
post data : "bcc=%5B%22%5C%22Test%20Act3%5C%22%20%3CTestAct3%40hotmail.com%3E%22%5D&body=Testing%20email%20body&body_content_type=text%2Fplain%3B%20charset%3Dutf-8&cc=%5B%22%5C%22Test%20Act2%5C%22%20%3CTestAct2%40yahoo.com%3E%22%5D&encoding_action=0&encoding_type=0&options=%7B%22flagged%22%3Afalse%2C%22priority%22%3A%221%22%7D&subject=Test%20Subject%20&to=%5B%22%5C%22rajesh.allagi%40accenture.com%5C%22%20%3Crajesh.allagi%40accenture.com%3E%22%5D"
POST
URL Buffer: http://127.0.0.1:8888/mail/message/199/send

Curl Easy perform
Curl Easy GetInfo response code
Curl easy getInfo content_length_download
Curl Error Code 0
Response Code 500
Status Code 500
Exception String Message rejected by plugin
ErrorInfo MessageServicePrivate::handleResponse Message rejected by plugin : 500 methodid MSIP::send
PIMCoreAccessPool::returnPca 1
Message Sent : 0


The above error I am getting for the below code snippet..

MessageService service;
// Initialize the current account if there is any
Account currentAccount;
const QList<Account> accounts = AccountService().accounts(
Service::Messages);
if (!accounts.isEmpty())
currentAccount = accounts.first();
MessageBuilder *builder = MessageBuilder::create(currentAccount.id());
qDebug() << "Account id : " << currentAccount.id();
QString subject = "Test Subject ";
MessageContact rto = MessageContact(-1, MessageContact::To, "", email);
QByteArray bodyData = "Testing email body";
builder->subject(subject);
bool added;
builder->addRecipient(rto, &added);
builder->body(MessageBody:lainText, bodyData);
Message message = *builder;
qDebug() << "Message : "<<message.errorDetails();
MessageKey key = service.send(currentAccount.id(), message);
qDebug() << "Message Sent : " << key;

This issue is only on personal side, where as the same code works fine on work side.  Please let me know if any one has faced the same issue and has the solution to the problem.


Thanks,
Rajesh

Retired
Posts: 54
Registered: ‎06-26-2012
My Device: BlackBerry Bold 9900

Re: Send email is getting failed... on personal side

Is that a valid account id 199? , does that account even exist on the device ?

New Contributor
Posts: 7
Registered: ‎04-11-2013
My Device: BB Z10

Re: Send email is getting failed... on personal side

[ Edited ]

Hello,

 

as kizkasen said, the first account you get is not an mail account.

 

I've found a solution do get the default mail account, but only the private one. I can't get access to the buisness account.

 

You've got to replace the the following:

 

const QList<Account> accounts = AccountService().accounts(
Service::Messages);

currentAccount = accounts.first();

 

with

 

Account currentAccount = AccountService().defaultAccount(Service::Messages);