1

i have a system that can send sms when setting a schedule to confirm their scheduled appointment, but there's an error +CMS ERROR : 305

            'SMS

            query = "SELECT * FROM schedule WHERE Phone_Number ='" & txtPhoneNumber.Text & "'"
            cmd = New MySqlCommand(query, MySqlConn)
            reader = cmd.ExecuteReader
            'TIME DATE SMS
            Dim date1, time1 As String
           date1 = Val(frmViewSchedule.dtpDate.Text)
            time1 = Val(frmViewSchedule.dtpTime.Text)
            txtMessage.Text = sys_msg + "TIME: " + time1 + " DATE: " + date1

            If reader.HasRows Then
                reader.Read()
                txtPhoneNumber.Text = reader.Item("Phone_Number")


                With SerialPort1
                    .Write("at" & vbCrLf)
                    Threading.Thread.Sleep(1000)
                    .Write("at+cmgf=1" & vbCrLf)
                    Threading.Thread.Sleep(1000)
                    .Write("at+cmgs=" & Chr(34) & txtPhoneNumber.Text & Chr(34) & vbCrLf)
                    .Write(txtMessage.Text & Chr(26))
                    Threading.Thread.Sleep(1000)
                    MsgBox(rcvdata.ToString)

                End With
            End If
ɐsɹǝʌ ǝɔıʌ
  • 4,440
  • 3
  • 35
  • 56
exeCUTE
  • 15
  • 1
  • 6

1 Answers1

3

CMS ERROR 305 means Invalid Text Format

The AT command to get in Text Mode is AT+CMGF=1 And PDU encoding is AT+CMGF=0

In Text Mode, encoding of the text when sending a SMS is important too. Standard GSM Encoding is AT+CSCS="GSM"

And to be on the safe side, start with at AT&F (Factory default configuration). You can issue an AT&F command at start of your session to overcome possible strange settings that may be stored in the modem.

ɐsɹǝʌ ǝɔıʌ
  • 4,440
  • 3
  • 35
  • 56
  • can i have favor? can you rewrite the code for me? i don't know where to insert that code you given. please? thanks I'm just a student so i don't have any idea for that. :) – exeCUTE Oct 02 '15 at 14:30
  • 1
    You already have the code written and it's ok. The only thing you need to change is the AT commands sent by SerialPort. Have a look at [**this**](http://www.smssolutions.net/tutorials/gsm/sendsmsat/) – ɐsɹǝʌ ǝɔıʌ Oct 04 '15 at 07:25