Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Codes for Bulk SMS using AT command

ryankai

Amateur
Advanced Member
Messages
113
Reaction score
0
Points
26
Im using AT command to send SMS through GSM modem, can anyone help me on how to send bulk or multiple recipient. Thanks in advance
 
Vb.net 2010

- - - Updated - - -

up.....................
 
put the list of contacts in an array and loop inside it calling the function every loop :thumbsup:
 
done it nothing happens, it seems may special condition dapat gawin with the AT command
 
use loop plus threading para di maghang ung system mo
 
use loop plus threading para di maghang ung system mo

hindi nmn nag hahang ung program continuos lang sya, once na loop ung program, tanging na sesend lang is ung first number then the rest hindi na
 
baka kelangan may pause ka every sms sent TS, parang

//Sleeps system for 1000 ms
System.Threading.Thread.Sleep(1000);

see the article here,
 
lagyan mo ng pause bago mag send ng another message
 
Sub conport()
comport.PortName = "COM3"
comport.BaudRate = 9600
comport.Parity = Parity.None
comport.StopBits = StopBits.One
comport.DataBits = 8
comport.Handshake = Handshake.RequestToSend
comport.DtrEnable = True
comport.RtsEnable = True
comport.NewLine = vbCrLf
End Sub

Sub sendsms(ByVal msg As String, ByVal num As String)
comport.Open()
If comport.IsOpen() Then
comport.Write("AT" & vbCrLf)
comport.Write("AT+CMGF=1" & vbCrLf)
comport.Write("AT+CMGS=" & Chr(34) & num & Chr(34) & vbCrLf)
comport.Write(msg & Chr(26))


Else
MessageBox.Show("Invalid Comport")
End If
comport.Close()
End Sub


Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
Dim x As Integer = 0
For x = 0 To ListView1.Items.Count - 1
y = ListView1.Items(x).Text
sendsms(txtmsg.Text, y)
System.Threading.Thread.Sleep(1000)
Next
MessageBox.Show("Send")
End Sub

this is my code, you can check kung may mali ako. I tried using "Sleep" kaso wala parin.. isa lang ung tinitxt nya

- - - Updated - - -

ok na po salamat
 
hindi nmn nag hahang ung program continuos lang sya, once na loop ung program, tanging na sesend lang is ung first number then the rest hindi na

May mali sa looping mo.
 
please note merong timeout for sending SMS in bulk. the telco might even block your number if you are sending too many messages from one sim card.

for bulk messaging i would suggest use an SMS gateway. My application sends about 100k SMS per month but using an SMS gateway from local telcos themselves. Othewise, your application will be considered illegal, if you are "abusing" their service.
 
please note merong timeout for sending SMS in bulk. the telco might even block your number if you are sending too many messages from one sim card.

for bulk messaging i would suggest use an SMS gateway. My application sends about 100k SMS per month but using an SMS gateway from local telcos themselves. Othewise, your application will be considered illegal, if you are "abusing" their service.

NOTED sir salamat
 
Try mo to TS.

Gawa ka ng table (sample MA_MessageOutbox) na may column na PROCESSED default 0.
Insert mo lahat ng sms na isesend mo sa table na yun.
Then, ilagay mo sa Timer etong function na to. Lahat ng Processed na may value na 0 yun yung isesend nya.

Private Sub MessageQueue()
Dim _lastrecord As Integer = 0
Dim _currentrecord As Integer = 0
Dim _dtMessageQueue As DataTable
Dim strMessage() As String

'No of all record
sql = <string>Select Count(*) LastRecord From MA_MessageOutbox</string>
_lastrecord = ExecuteSQLQuery(sql).Rows(0)("LastRecord")

'Loop until not equal
Do While _currentrecord <> _lastrecord
sql = <string>
Select Top 1 PK, MobileNo, Keyword, Response, SentTime, Processed, Priority
From MA_MessageOutbox Where Processed = 0
Order By Priority, PK
</string>
_dtMessageQueue = ExecuteSQLQuery(sql)

'Exit MessageQueue Process if no record to send.
If _dtMessageQueue.Rows.Count = 0 Then
Exit Sub
End If

'Split Message into 160 Character per Send
strMessage = SplitSMS(_dtMessageQueue.Rows(0)("Response"), 155)

For i As Integer = 0 To strMessage.GetUpperBound(0)
Try
With SerialPort1
.Write("AT" & vbCrLf)
Threading.Thread.Sleep(2000)
.Write("AT+CMGF=1" & vbCrLf)
Threading.Thread.Sleep(2000)
.Write("AT+CMGS=" & Chr(34) & _dtMessageQueue.Rows(0)("MobileNo") & Chr(34) & vbCrLf)
.Write(strMessage(i) & Chr(26) & vbCrLf)
Threading.Thread.Sleep(2000)
End With
Catch ex As Exception
MsgBox(ex.Message)
End Try
Next

'Update current queue message Processed = 1
ExecuteSQLQuery("Update MA_MessageOutbox Set SentTime = '" & statLabelToday.Text & "', Processed = 1 Where PK = " & _dtMessageQueue.Rows(0)("PK") & " and MobileNo = '" & _dtMessageQueue.Rows(0)("MobileNo") & "'")

'No of record Processed = 1
sql = <string>Select Count(*) CurrentRecord From MA_MessageOutbox Where Processed = 1</string>
_currentrecord = ExecuteSQLQuery(sql).Rows(0)("CurrentRecord")
Loop
End Sub
 
any GSM gateway na pede nyo irecommend?
 
Back
Top Bottom