Bulk text SMS is in trend, now it becomes a central communication tool for organizations and businesses across the globe. There are many platforms are available for bulk SMS, which...
If you want to send SMS through the serial port in C#, then this article will help you to set a proper set up through which you can easily send SMS. Sending SMS alerts to a mobile phone becomes a common demand of clients. Nowadays, most of the developers are using a GSM Modem software to send an SMS With this serial port any small application that runs on the server to sends an SMS whenever a new record is inserted into the database from any client.
We will need following things:
Procedure to create a serial port in C#:
1 Create the table in SQL Server.
CREATE TABLE [dbo].[Donor_Profile](
[Don_Date] [datetime] NULL,
[Don_Donor_ID] [varchar](20) NOT NULL,
[Don_Donor_Name] [varchar](50) NULL,
[Don_Mobile_Phone] [varchar](50) NULL,
[Don_Member] [varchar](10) NULL,
[Don_SMS1] [varchar](10) NULL,
[Don_SMS2] [varchar](10) NULL,
[Don_Logo] [image] NULL,
[Don_Donor_Type] [int] NULL,
CONSTRAINT [PK_Donor_Profile] PRIMARY KEY CLUSTERED
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
2 Now you insert any record in this table
[Don_Donor_ID]= CF-00001-12 and leave the [Don_SMS1], [Don_SMS2] field NULL, [Don_Mobile_Phone] please enter valid phone number where you want to recive the sms.
3 After that create a new Desktop application.
4 Now design a form including option of Portal Name, Pending SMS, Send SMS, Filed SMS
5 Now we need to include the following DLL files in the bin\ Debug folder:
6 After that add reference to the project
7 Now add one more reference.
8 Now move to the code behind the window and use these references in the code.
9 Now, add text boxes and private variables in the form and use it in the source code.
10 Now add two classes Operation and Main
11 Add two methods in it i.e GetDBConnection, IP config and then Execute.
12 Now add the code to create load event, send button and click button in the form
13 Now attach a modem to the system, it will install its own application. After completing the installation process, close the application because that software captures the port that we will use in our code.
14 Now run the application by pressing F5.
15 Now select port name from the drop down menu and then press the connect button. If the port is not valid then it will display the error message.
16 Now select port COM4, it will connect successfully. Check all the port one by one.
17 Now press the Send SMS button
In this way, you can send SMS Through Serial port in C#. Still, if you found any problem in sending SMS then you can drop your problem in a comment section.