Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Revision as of 06:34, 14 June 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:Sending an SMS using Symbian C++

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Code ExampleTested with
Devices(s): Nokia 6220 Classic
Platform(s): S60 3rd Edition; S60 3rd Edition, FP1; S60 3rd Edition, FP2; S60 5th Edition
S60 3rd Edition FP2
Keywords: RSendAs, RSendAsMessage, RSendAs::Connect(), RSendAsMessage::CreateL(), RSendAsMessage::AddRecipientL(), RSendAsMessage::SetBodyTextL(), RSendAsMessage::SendMessageAndCloseL()
Created: tapla (13 Feb 2009)
Last edited: hamishwillee (14 Jun 2013)



This code snippet demonstrates how to send an SMS using RSendAs and RSendAsMessage.

MMP file

The following library is required:

LIBRARY sendas2.lib

You may also want to add the following capability:

CAPABILITY NetworkServices

The capability is not required but without it the application asks for permission to send the message.

Header file

private:  // New methods
void SendSMSL();

Source file

#include <rsendas.h>
#include <rsendasmessage.h>
#include <smut.h>
void CAppUi::SendSMSL()
RSendAs sendAs;
TInt err = sendAs.Connect();
if (err) {
// TODO: Error handling
RSendAsMessage sendAsMessage;
sendAsMessage.CreateL(sendAs, KUidMsgTypeSMS);
// Add the receiver
_LIT(KReceiver, "+358123123123");
sendAsMessage.AddRecipientL(KReceiver, RSendAsMessage::ESendAsRecipientTo);
// Set the body text
_LIT(KBodyText, "Hello!");
// Send the message
CleanupStack::Pop(); // sendAsMessage (already closed)
CleanupStack::PopAndDestroy(); // sendAs
_LIT(KInfoText, "Message sent.");


The application sends an SMS to the number specified in the code.

Supplementary material

  • You can test SMS sending features in action in a simple, executable application into which this code snippet has been patched. The application is available for download at Media:ExampleStub w SMS
  • You can examine all the changes that are required to implement SMS sending in an application. The changes are provided in unified diff and colour-coded diff formats: Media:Sending an
  • For general information on applying the patch, see Using Diffs.
  • For unpatched stub applications, see Example stub.
This page was last modified on 14 June 2013, at 06:34.
76 page views in the last 30 days.