Send SMS to more than one recipient
| Thu, 2008-04-10 10:07 | |
|
Hi, I am trying to send the same SMS to varius phone numbers includded in the aAddrArray variable. So I have extended the RSendAs example to add N recipients with the AddRecipientL method with the next
void CSmsEngine::SendSmsInThirdEditionL(RArray<HBufC*>* aAddrArray, const TDesC& aMsg) {
RSendAs sendAs;
User::LeaveIfError(sendAs.Connect());
CleanupClosePushL(sendAs);
RSendAsMessage sendAsMessage;
sendAsMessage.CreateL(sendAs, KUidMsgTypeSMS);
CleanupClosePushL(sendAsMessage);
//Add the receivers
TInt i = 0;
for(i = 0; i < aAddrArray->Count(); i++){
sendAsMessage.AddRecipientL(*(*aAddrArray)[i], RSendAsMessage::ESendAsRecipientTo);
}
sendAsMessage.SetBodyTextL(aMsg);
// send the message
sendAsMessage.SendMessageAndCloseL();
// sendAsMessage (already closed)
CleanupStack::Pop();
// sendAs
CleanupStack::PopAndDestroy();
}
After I execute this code, in my outbox only appear one message sent to the first receiver included. Any idea? |
|





