Click here to Skip to main content
15,886,074 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to send sms to mobile from windows application using c#.net???
Posted
Comments
dan!sh 10-Nov-14 1:45am    
There are plenty of APIs available to do this. Please search and chose the one that serves you best.
Thanks7872 10-Nov-14 2:05am    
And your question is?

there are a few ways, two being :-

a) use a web based sms provider - typically you send them a request using a http based API - you typically pay for this service by volume of sms's sent

b) use a GPRS Modem - possibly via a Serial/USB port interface - you typically pay for this by purchasing a one-of GPRS modem, then SMS/SIM Data charges from the SIM provider
 
Share this answer
 
v3
Following is one example to do this:-





C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;


namespace SMSWinApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private SerialPort _serialPort;
        private void button1_Click(object sender, EventArgs e)
        {
            string number = textBox1.Text;
            string message = txtMessage.Text;




            //Replace "COM8"withcorresponding port name
           _serialPort = new SerialPort("COM8", 115200);


            Thread.Sleep(100);

            _serialPort.Open();

            Thread.Sleep(100);

            _serialPort.Write("AT+CMGF=1\r");

            Thread.Sleep(100);

            _serialPort.Write("AT+CMGS=\"" + number + "\"\r\n");

            Thread.Sleep(100);

            _serialPort.Write(message + "\x1A");

            Thread.Sleep(300);

            label1.Text = "Message sent !!";

            _serialPort.Close();
        }
    }
}
 
Share this answer
 
Comments
mailtoshafaqat 19-Sep-18 14:48pm    
how to send more than 160 char according to this code please help.
SO Answers[^]
http://www.notepage.net/[^]
You have to use third party tool/API to be integrated to your application.
Go through the links above.
I hopw these documentations help you.
Thanks
:)
 
Share this answer
 

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