hi guys i develop an application in vb6.0 sending to mobile # is fine but when i try to send two or more mobile # it will only send to the first # and the other is none. here is my code please take a look.
MSComm1.Output = "AT" & vbCrLf
Sleep 100
MSComm1.Output = "AT+CMGF=1" & vbCrLf
Sleep 200
MSComm1.Output = "AT+CMGS=" & Chr(34) & tmpM_MobileNum & Chr(34) & vbCrLf
Sleep 300
MSComm1.Output = "AT+CMGS=" & Chr(34) & tmpF_MobileNum & Chr(34) & vbCrLf
Sleep 400
MSComm1.Output = TMPMESEJ & Chr(26) & vbCrLf
Sleep 500
i hope you can help me at this. Thank you
To send an SMS via a modem you are correct in using the AT+CMGS but I believe you are not following the syntax of the command correctly.
You need to send the following:
AT+CMGS=<Mobile phone number><cr>
<Message text><ctrl-Z>
You can only send one message at a time to one mobile phone number. And from what I can see your code is attempting to send multiple messages before trying to send the <ctrl-Z>
By the way is ascii character 26.
////////////////////////////////////////
// Send message to first mobile number
////////////////////////////////////////
MSComm1.Output = "AT+CMGS=" & Chr(34) & tmpM_MobileNum & Chr(34) & vbCrLf
// Wait for answer from modem should return ">"
MSComm1.Output = "Test Message One" & Chr(26)
// Wait for answer to check if OK came back
////////////////////////////////////////
// Send message to second mobile number
////////////////////////////////////////
MSComm1.Output = "AT+CMGS=" & Chr(34) & tmpF_MobileNum & Chr(34) & vbCrLf
// Wait for answer from modem should return ">"
MSComm1.Output = "Test Message Two" & Chr(26)
// Wait for answer to check if OK came back