Programatically sending an SMS Message

Platforms:

The RSendAsMessage has been introduced in Symbian v9 and greatly simplifies the sending of a short messages (SMS) in C++.

// Link against sendas2.lib
#include <rsendas.h>
#include <rsendasmessage.h>
#include <senduiconsts.h>

...

 // Open a connection with the SendAs server
 RSendAs saSrv;
 saSrv.Connect();
 CleanupClosePushL(saSrv);
       
// Create your message
RSendAsMessage msg;
msg.CreateL(saSrv, KSenduiMtmSmsUid);
CleanupClosePushL(msg);
msg.AddRecipientL(aRecipientNumber,RSendAsMessage::ESendAsRecipientTo);       
msg.SetBodyTextL(aMessageText);
 
// Send the message
msg.SendMessageAndCloseL();
       
// Cleanup
CleanupStack::Pop(&msg);
CleanupStack::PopAndDestroy(&saSrv);


Programatically sending an SMS Message

Hi Eric, I have a question. Where from have you got "KSenduiMtmSmsUid"? I want Uid for mail. Can u please help me out? Thanks in advance, Nil

Programatically sending an SMS Message

Hi Nil

Yoy can use the CSendAsMessageTypes to query about available messagetypes and also find the human readable form of the message types. See the Symbian docs e.g http://www.symbian.com/developer/techlib/v9.1docs/doc_source/reference/reference-cpp/N1026A/CSendAsMessageTypesClass.html#%3a%3aCSendAsMessageTypes I Guess you can also have a look at where the constant KSenduiMtmSmsUid is defined and look for the mail equivalent.

Also, there is a minor fault in the example. The local RSendAsMessage variable is sometimes called message and sometimes message. But I guess you got that one.

/Anders

Programatically sending an SMS Message

How and where do you define KSenduiMtmSmsUid?

Thanks

Programatically sending an SMS Message

It is in senduiconsts.h

Re: Programatically sending an SMS Message

Thanks Eric,

Using this article, now i able to send SMS.

Now i want to read incomming SMS & if that came from any perticular number,
i want to read text body of that sms and write that text in .txt file.

I found couple of examples on this site.
But i just want to know that is there any easier method in Symbian v9 like (easy method for sending sms in symbian V9) "RSendAsMessage".

Thanks