Skip to content
/ EJC-SMS Public

EJC Short Message Service Library based on C# Language and VB .Net in ability to add SMS Feature on your existing project in just few lines of code.

License

Notifications You must be signed in to change notification settings

eksqtr/EJC-SMS

Repository files navigation

EJS SMS (Short Message Service)

Version 0.5 - March 15, 2020

Available in: C# and VB .Net


Having trouble on making your own Send and Read Messages code for your Project / System using your GSM Modem Device? Say no more. EJC SMS (EJC Short Message Service) is a library uses AT Comamnd that will let you to Send and Read Messages at ease in which helps you to minimized your time developing your system with SMS Feature.


EJC SMS Features

  • Easy to use
  • Code Friendly
  • Ability to Send Single SMS
  • Ability to Send Multiple Recipients
  • Ability to Read Inbox SMS
  • Smart Validiation of Phone Numbers based on Philippines Sim Card Prefixes

EJC SMS Available Functions:

  • InitSMS()

    • Parameter: port_name (string)

    • Initialize the EJC SMS with your Com Port of GSM Modem Device. To get the port you must check it on Device Manager> Ports (Com & LPT)

  • IsValidRecipientNumber()

    • Parameter: recipient_number (string)

    • Return: return as boolean true: means valid false: invalid

    • Smart Validation if the number is valid based on Sim Card Philippines Prefixes.

  • SendSMS()

    • Parameter: recipient_number (string) | recipient_message (string)

    • Return: return as boolean true: means success false: failed

    • Send Single Message to a Recipient.

  • SendMultipleSMS()

    • Parameter: number (List), recipient_message (string)

    • Return: return as integer where it counts number of fail to send to recipient.

    • Send Message to Multiple Recipient.

  • ReadAllMessages()

    • Parameter: None

    • Return: return as DataTable

    • Reads all the Messages in your Sim Card Inbox.


Tutorial on how to use it in C# Language.

Sending Single Message

  • Step 1: Intiantiate the EJCSMS.cs from your form the above of all form control methods.

    • EJCSMS SMS = new EJCSMS(allow_long_msg: true, allow_empty_sms: false);

  • Step 2: On Form_Load Init EJC SMS with your existing port of your GSM Modem Device

    • SMS.InitSMS(GSM_MODEM_PORT); // Initialize the SMS.

  • Step 3: Call the SendSMS() method on SMS Object.

    • SMS.SendSMS("your_phone_number", "your message here");

  • You are done! Easy right?

Sending Message to Multiple Recipient

  • Step 1: Intiantiate the EJCSMS.cs from your form the above of all form control methods.

    • EJCSMS SMS = new EJCSMS(allow_long_msg: true, allow_empty_sms: false);

  • Step 2: On Form_Load Init EJC SMS with your existing port of your GSM Modem Device

    • SMS.InitSMS(GSM_MODEM_PORT); // Initialize the SMS.

  • Step 3: Declare List phonenumba = new List(); and add some phone numbers to it.

    • List< string > phonenumba = new List < string > ();

    • phonenumba.Add("phone_number_1");

    • phonenumba.Add("phone_number_2");

    • phonenumba.Add("phone_number_3");

  • Step 4: After adding phone number on the List you can just call phonenumba and insert it on SMS.SendMultipleSMS first parameter.

    • SMS.SendMultipleSMS(phonenumba, "Your message here");

  • You are done!

How to Read All Messages

  • Step 1: Intiantiate the EJCSMS.cs from your form the above of all form control methods.

    • EJCSMS SMS = new EJCSMS(allow_long_msg: true, allow_empty_sms: false);

  • Step 2: On Form_Load Init EJC SMS with your existing port of your GSM Modem Device

    • SMS.InitSMS(GSM_MODEM_PORT); // Initialize the SMS.

  • Step 3: Create a DatagridView Control on your form. Then just set the datasource just like this.

    • yourDataGridView.DataSource = SMS.ReadAllMesasges();

  • You are done! Easy right? with EJC SMS you can show all SMS in just one line.


Tutorial on how to use it in VB .Net

Sending Single Message

  • Step 1: Intiantiate the EJCSMS.cs from your form the above of all form control methods, And declare string variable for your gsm modem port

    • Dim SMS As New EJCSMS(allow_long_msg:=True, allow_empty_sms:=False)

    • Dim GSM_MODEM_PORT As String = "COM5" ' please change this according to your GSM Modem Port

  • Step 2: On Form_Load Init EJC SMS with your existing port of your GSM Modem Device

    • SMS.InitSMS(GSM_MODEM_PORT) // Initialize the SMS.

  • Step 3: Call the SendSMS() method on SMS Object.

    • SMS.SendSMS("your_phone_number", "your message here")

  • You are done! Easy right?

Sending Message to Multiple Recipient

  • Step 1: Intiantiate the EJCSMS.cs from your form the above of all form control methods, And declare string variable for your gsm modem port

    • Dim SMS As New EJCSMS(allow_long_msg:=True, allow_empty_sms:=False)

    • Dim GSM_MODEM_PORT As String = "COM5" ' please change this according to your GSM Modem Port

  • Step 2: On Form_Load Init EJC SMS with your existing port of your GSM Modem Device

    • SMS.InitSMS(GSM_MODEM_PORT) // Initialize the SMS.

  • Step 3: Declare List phonenumba = new List(); and add some phone numbers to it.

    • Dim recipient_number As New List(Of String)

    • phonenumba.Add("phone_number_1");

    • phonenumba.Add("phone_number_2");

    • phonenumba.Add("phone_number_3");

  • Step 4: After adding phone number on the List you can just call phonenumba and insert it on SMS.SendMultipleSMS first parameter.

    • SMS.SendMultipleSMS(phonenumba, "Your message here")

  • You are done!

How to Read All Messages

  • Step 1: Intiantiate the EJCSMS.cs from your form the above of all form control methods, And declare string variable for your gsm modem port

    • Dim SMS As New EJCSMS(allow_long_msg:=True, allow_empty_sms:=False)

    • Dim GSM_MODEM_PORT As String = "COM5" ' please change this according to your GSM Modem Port

  • Step 2: On Form_Load Init EJC SMS with your existing port of your GSM Modem Device

    • SMS.InitSMS(GSM_MODEM_PORT) // Initialize the SMS.

  • Step 3: Create a DatagridView Control on your form. Then just set the datasource just like this.

    • yourDataGridView.DataSource = SMS.ReadAllMesasges()

  • You are done! Easy right? with EJC SMS you can show all SMS in just one line.


SMS Sending error? or No SMS receive?

You can check EJC_SMS Directory folder inside of your respective project (/bin/debug/EJC_SMS). There you can find debug.txt and error.txt allowing you to determine what cause your SMS fail in some events.

Directory Folder:

Directory

Debug:

DebugTxt

Error:

ErrorTxt


I made an example System on how to use this EJC SMS

Singe Recipient

SendSMSSingle SendSMSSingleProof

Multiple Recipient

SendSMSMultiple SendSMSMultipleProof

Reading SMS

ReadSMS

Back-end and Front-end developed by: EJC

About

EJC Short Message Service Library based on C# Language and VB .Net in ability to add SMS Feature on your existing project in just few lines of code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published