Click here to Skip to main content
15,898,538 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I want the code to send sms message for mobiles using C#.net and we are storing all the mobile numbers in database using sqlserver2000

m new so plez help me through code or helping sites

Thanks in advance
Posted

You may use 3rd party libraries to do the task.
See this article: How To Send and Receive SMS using GSM Modem[^]
Using 3rd party libraries will make your task very easy.

But you may also choose to write your own code. Consider the guidelines below:
Modems(in your case mobile) understands AT commands. So you need to learn AT commands first. Refer: Introduction to AT commands[^]
After you have studied AT commands,
There are few steps you need to perform in order to send AT commands to mobile using C#
1)Configure and open the serial port using using System.IO.Ports class
- SerialPort.Open() and SerialPort.Close() API are available for doing the same.

2)Write the AT command to opened COM port in step 1.
Serialport.Writeline() API can be used for same.

Example code is pasted for doing same:
C#
private SerialPort portConfig = new SerialPort();

// configure port
portConfig.PortName = COM4 ;
.....
.....
//open the port
portConfig.Open();

// send AT command to dial a number
portConfig.WriteLine("ATD" + mobileNumber + ";");


Read the below article. It doesn't use any 3rd party library for sending/receiving sms using gsm modem.
Send and Read SMS through GSM Modem using AT Commands[^]

Hope it helps. If you still have issues get back.

Finally a suggestion: This question has been asked so many times in the forum. Please do search once before you ask.
 
Share this answer
 
v2
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900