How to SMS using the SmsComposeTask for Windows Phone 7

Unlike Windows Mobile with Windows Phone 7 we are currently unable to directly send an SMS from within an application unless we show the composer screen using SMSComposerTask.  This does suck a little bit as we now Aps cant send SMS’s direct or intercept them at all for that matter.  So what does WP7 offer – well to send an SMS you can use SMSComposerTask and to intercept an SMS – nothing, you will need to re-think your application architecture

To send an SMS using the composer in Windows Phone 7 you need to do the following:   

  1. Add using statement to Tasks namespace
  2. using Microsoft.Phone.Tasks;
  3. Create an instance of SMSComposerTask set the To field and body then call Show:
  4. SmsComposeTask sms = new SmsComposeTask();
    sms.To = "0123456789";
    sms.Body = "Some prefilled text...";
  5. Result
  6. SmsComposerTask Windows Phone 7

    SmsComposerTask Windows Phone 7

If your application really can’t live without direct access to send and intercept an SMS without any user interaction in the composer:   

  1. Then you can wait and they may add it in future releases although I am unsure if this will ever occur and I would not rely on it
  2. Or you may be able to rework your architecture to replace SMS with Push Notifications, a WCF service and Database or XML as your storage. The obvious downside to this is that you loose the telcos serverside infrastructure and have to replace it yourself. This adds a lot more code and cost to the developer for implementation and continual subscription costs for hosting which then means your cool free App idea may become too costly.

If your application can live without SMS interception but needs direct access to send and SMS without any user interaction in the composer:

  1. Then you may be able to use those options listed above
  2. Or, look into SMS providers that provide a web service based API – needless to say if you can’t figure out how to oncharge this to the end user this will also cost you but it may be significantly less then hosting depending on your volume


  • Pingback: Stepping into the Globe of SMS Cell Phone Advertising and marketing | Web Hosting UK Blog

  • Bill

    How can make an app that encrypt my sms before sending ???I will use SmsComposeTask ? or else?

  • nick.harris

    Hi Bill,

    You would only be able to encrypt the text that you are supplying to the SMSComposeTask. Do keep in mind that the recipient will have to be able to decode it at the other end and at present you can’t intercept SMS messages on WP7.

    Kind Regards,

  • Bill

    Ok . This means that i can’t to decrypt sms ?? Other way to make it ???

  • Jeff

    Nick – Do you know how you can send a SMS to more than 10 people? I’ve seen it done, however, I am not seeing how they are accomplishing it. I don’t see an onCompleted Event as every time I the .Show() (if I try to break them up into groups of 10) for command for the SMSTask I get an error.

    Any ideas?

  • nick.harris

    Hi Jeff,

    I just gave it a go sending 11 SMS to myself. To send more then 10 SMS just delimit the To property with a semicolon ;
    e.g sms.To = “123;123;123…”.

    If you cant send all at once and have to break them into groups it is going to be a bit more effort for you as the SMSComposeTask can cause your application to be tombstoned so your going to need to maintain a list of say your 100 sms recipients numbers take 10 off the list then call sms.Show(). You then will have to preserve the state of your app in your case the list of 90 remaining recipients see as a good entry point about WP7 Execution Model. When your application is Activated you will have to get your list of recipients from your preserved state and then continue with the above untill all are sent i.e no items left in list.

    Kind Regards,
    Nick Harris

    Kind Regards,

  • gafsi

    Is it possible to intercept incoming SMS with Push notifications ?, Can you write c# code to do that ?

  • Deva

    Pro grammatically get the value from SMS Composer in Windows Phone 7 .

    In my programme i will show the SMS Composer . user will type To and body text to send sms. Here i want to access To field of sms composer.

    Is there any way ? and is it possible to override sms composer event ?