Sending SMS though our own application is very necessary when we talking business application. Windows Mobile SDK comes with PocketOutlook that we can use to send SMSs.
First you need to create a smart device application. and layout your form as below.
Then add the PoketOutlook assemply to your application as a reference.
here is the code.
Method1
using Microsoft.WindowsMobile.PocketOutlook;
private void btnSend_Click(object sender, EventArgs e)
{
String number = txtNumber.Text;
String boby = txtBody.Text;
SmsMessage message = new SmsMessage(number,boby);
message.Send();
}
Method2 – Send SMS to Multiple recipients
private void btnSend_Click(object sender, EventArgs e)
{
SmsMessage message = new SmsMessage();
Recipient r1 = new Recipient("Name1", txtNumber.Text);
Recipient r2 = new Recipient("Name2", "0772789456");
message.To.Add(r1);
message.To.Add(r2);
message.Body = txtBody.Text;
message.Send();
}
Comments
This is the win32 unhandled exception comes... :(
I think this is because of the simulator. You want to use Cellular Emulator to fake the cabability of sending messages. (normally found in "%ProgramFiles%\Windows Mobile 6 SDK\Tools\Cellular Emulator").
Refere :- http://blogs.msdn.com/b/dglover/archive/2007/04/03/how-to-connect-the-windows-mobile-device-emulator-v2-to-the-wm6-sdk-cellular-emulator.aspx
I think this is because of the simulator. you need to fake smsm cabalility by using Cellular Emulator ("%ProgramFiles%\Windows Mobile 6 SDK\Tools\Cellular Emulator)
Refere :- http://blogs.msdn.com/b/dglover/archive/2007/04/03/how-to-connect-the-windows-mobile-device-emulator-v2-to-the-wm6-sdk-cellular-emulator.aspx