steps to achieve this->
1. connect a cell phone to you computer using a Serial port connection,
2. this is a code written in c#, using "AT" command set.
Rest, no one will spoon feed you.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using MySql.Data.Types;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SerialPort _serialPort;
StringComparer stringComparer = StringComparer.OrdinalIgnoreCase;
_serialPort = new SerialPort();
_serialPort.PortName = textBox2.Text;
_serialPort.BaudRate = 2400;
_serialPort.Parity = Parity.None;
_serialPort.DataBits = 8;
_serialPort.StopBits = StopBits.One;
_serialPort.Handshake = Handshake.RequestToSend;
string b;
b = textBox1.Text;
if (b.Length <= 158)
{
try
{
MySqlConnection con = new MySqlConnection();
con.ConnectionString = "server=localhost;Database=sms;uid=root;pwd=root";
con.Open();
MySqlDataReader myReader = null;
MySqlCommand myCommand = new MySqlCommand("select * from p_sms", con);
myReader = myCommand.ExecuteReader();
_serialPort.Open();
while (myReader.Read())
{
Thread.Sleep(5000);
string ph;
ph = myReader[0].ToString();
MessageBox.Show(ph);
_serialPort.Write("at" + (char)13 + (char)13);
_serialPort.Write("at+cmgf=1" + (char)13 + (char)13);
_serialPort.Write("at+cmgs=\"" + ph + "\"" + (char)13 +(char)13);
_serialPort.Write(b + (char)26 + (char)26 + (char)13);
}
_serialPort.Close();
con.Close();
textBox1.Text = "";
}
catch (Exception ex)
{
MessageBox.Show("chk out the hardware connected ");
}
}
else
{
MessageBox.Show("text out of length.please enter a msg less then 160 characters");
}
}
private void button2_Click(object sender, EventArgs e)
{
new phone_no_table().Show();
}
}
}