Click here to Skip to main content
15,905,963 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how do i send a long sms exceeding 160 characters using AT command
this is my code:
VB
Dim isSend As Boolean = False
Try
    Dim recievedData As String = ExecCommand(port, "AT", 300, "No phone connected")
    recievedData = ExecCommand(port, "AT+CMGF=1", 300, "Failed to set message format.")
    Dim command As [String] = "AT+CMGS=""" & PhoneNo & """"
    recievedData = ExecCommand(port, command, 300, "Failed to accept phoneNo")
    command = Message & Char.ConvertFromUtf32(26) & vbCr
    recievedData = ExecCommand(port, command, 3000, "Failed to send message")
    '3 seconds
    If recievedData.EndsWith(vbCr & vbLf & "OK" & vbCr & vbLf) Then
	isSend = True
    ElseIf recievedData.Contains("ERROR") Then
	isSend = False
    End If
    Return isSend
Catch ex As Exception
    Throw ex
End Try
Posted
Updated 28-Mar-13 1:50am
v2
Comments
Anil Honey 206 28-Mar-13 7:29am    
Your sending Sms through Modem
Ankur\m/ 28-Mar-13 7:54am    
Your code seems fine to me. Message Format 1 is PDU mode right? The character limit is in Text mode.
Google and you shall find more details.

1 solution

using AT-commands (GSM-device or mobile attached with PC)
May be your device allowing 128 chars only in a single message.

you can split long message in two or more sms. because in this case(for AT-commands), if your device support only 128 chars per sms then there are no extra settings available to extend the limit from 128 to 160 chars in your current device.

you can also use 3rd party bulk sms service for this...

Happy Coding!
:)
 
Share this answer
 
v4
Comments
Ankur\m/ 28-Mar-13 7:53am    
Can you give a reference supporting your statement - "there is no way to extend the limit from 128 to 160 chars".
Because AFAIK, the limit depends upon the modem. And if the modem supports PDU mode, sending sms more than 160 chars is also possible.
Aarti Meswania 28-Mar-13 8:06am    
actually I had faced same isuue with GSM modem and mobile also. and I had to partition my long message in to 2 sms (128chars per sms). so, that I shared my experience.

and it's good if you sure about "the limit depends modem supports PDU mode, sending sms more than 160 chars is also possible." then please suggest OP that device name or some of manufactures so, this could solve OP's problem.

and I am modifying my sentence. "there is no way to extend the limit from 128 to 160 chars." to "there is no way to extend the limit from 128 to 160 chars in your current device."
thanks
:)

Mohamed Farhan 20-May-15 2:06am    
Can i get the code (long message in to 2 sms)... where did you shared???

Thank you.
Member 11947406 9-Oct-15 3:21am    
i also facing same please some one suggest me a proper solution with example code

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