hi all ,

i used CSendAs::ClientMtm and CSendAs::ClientRegistry for sending massage.
i put some code here plz tell me why not sending massage through my code .

TRAPD(aError,sendAs = CSendAs::NewL(*this));
sendAs->SetMtmL(KUidMsgTypeSMS);
sendAs->SetService(0);

sendAs->CreateMessageL(KMsvGlobalOutBoxIndexEntryId);
sendAs->AddRecipientL(KTelNumber);
sendAs->ClientMtm().Body().InsertL(0, KTag);
TInt r;
User::LeaveIfError(r = sendAs->ValidateMessage());
sendAs->SaveMessageL(ETrue);

// Get the client mtm
CBaseMtm &clientMtm = sendAs->ClientMtm();
// Get the session of the client
CMsvSession &session = clientMtm.Session();

CClientMtmRegistry *mtmUiRegistry = CClientMtmRegistry::NewL( session, 30000000 );
// Create base mtm ui
//CBaseMtm * baseMtm;
TRAPD(aError1, baseMtm= mtmUiRegistry->NewMtmL( KUidMsgTypeSMS ));

TMsvEntry entry(sendAs->ClientMtm().Entry().Entry());
entry.iDate.HomeTime();
entry.SetOffPeak(EFalse);
sendAs->ClientMtm().Entry().ChangeL(entry);


CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection;
CleanupStack::PushL(sel);
sel->AppendL(entry.Id());

CMsvOperation* operation = NULL;
CleanupStack::PushL(operation);

CMsvOperationWait* waiter=CMsvOperationWait::NewLC();
TBuf8<1> dummy;
operation=baseMtmUi->InvokeAsyncFunctionL(ESmsMtmCommandScheduleCopy,*sel,dummy,waiter->iStatus);
waiter->Start();
SetActive();

CActiveScheduler::Start();

CleanupStack::PopAndDestroy(3);


in Runl
void sendsms::RunL()
{
console->Printf(_L("runl"));
}
plz tell me error in my code .after sending sms i give Message Sending failed !!!!!

and message is save into outbox but after sending that they give Message Sending failed and deferred message.

for ref code i used this link
http://www3.symbian.com/faq.nsf/0/53...8?OpenDocument
plz any one help me.