me doing attendance project in vb... i need to send automatic SMS from e-mail to phone number...... please help me .... and post some sample codings tooo...

Dani AI

Generated

Quick summary and practical paths (ties to thread): the attendance app can send SMS two reliable ways — (A) use a commercial SMS gateway/REST API (the simplest, scalable option that and pointed toward), or (B) use a local GSM modem and AT commands (hardware control). Public carrier email->SMS gateways are increasingly unreliable and being shut down; avoid relying on raw email-to-carrier routes for production alerts. (twilio.com)

About the reported "Run-time error 6: Overflow" (from ): that error usually means a numeric value exceeded a VB numeric type. Phone numbers must be handled as strings, not numeric literals (many phone numbers are larger than VB Long). Store the number in a String or call CStr, and inspect the SMS library method signature in the Object Browser to confirm parameter types. (stackoverflow.com)

If choosing a gateway (recommended for auto attendance SMS): register with a provider, get API credentials, test with sandbox/free credits, and send HTTPS requests from VB (MSXML/WinHTTP). Always normalize numbers to E.164 (leading + and country code), URL-encode the message body, log HTTP responses and delivery receipts, and follow carrier compliance rules (US A2P/10DLC etc.). Gateways supply VB/VB.NET examples and samples to copy into a VB6 app or a small server shim. (twilio.com)

If using a GSM modem: confirm COM port and baud, set text mode, then send the message with AT commands (wait for the prompt and finish the body with Ctrl+Z / char 26). Example sequence:

AT+CMGF=1
AT+CMGS="+14155552671"
> Hello — attendance recorded. <Ctrl+Z>

Test first with a terminal program (PuTTY/HyperTerminal), verify SIM credits and SMS center settings, and remember message encoding/segmenting (GSM-7 vs UCS-2 affects length and cost). (developershome.com)

Key troubleshooting checklist: treat phone numbers as strings, test AT commands in a terminal, check COM settings, inspect the SMS COM/SDK docs for parameter types, and prefer a gateway API for reliability and scale.

Recommended Answers

All 6 Replies

1. SMS is not sent from e-mail

2. Before asking for code you need to show effort and post the code that you are working on.

3. Does you project included any database operation ? If yes -- which DB ? How you connect VB to DB ?

sorry.... sms from free-sms website ..

Dim modem As SMSModem
Set modem = New SMSModem
modem.LogTrace = True
modem.OpenComm gsmModemCustom, 110279, , smsNotifyNone
Call modem.SendTextMessage(9677021112#, hi)

error is run time error 6 overflow

sms from free-sms website

I don't think there is a free sms provider.

I am also not that versed in gsm. I am using "Clickatel" which is probably one of the best services available. When you download their drivers and sdk, it gives you 5 free sms's to test your app. The main NICE thing is that they give you FULL code samples for vb6 as well, which works perfect. Unfortunately, after 5 attempts, you need to buy more credits/sms time.

Just go to their site and download all you need.:)

sir give the steps to do in clickatel... and necessary source codes

Show some effort and search the site.

This is the link to the download site and then select the following option -

* COM Object API
Popular with windows-based developers, the Clickatell COM API's rich set of methods and definitions make it easy for a user to integrate SMS sending into their programs or ASP pages . Sign up.

You need sign up first before you can download the com api. Once done, download and then go into the folder. There is a folder called vb6. Inside is a full application written in vb6 WITH commented code to help you set it up.:)

This is now solved, please mark it as solved, thanks.

i also use to send sms to students that are stored in csv file, but i dont use and free service or windows api, i just purchased bulk sms service and use there api to send sms
code goes like this...

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim PathtoTextFile As String
Dim PathtoMDB As String
Dim myarray() As Variant

Public URL As String
Public oHttpReq As XMLHTTP30

Public oXMLDoc As DOMDocument30

Private Sub cmdbalance_Click()
List1.Clear
URL = "" & userid.Text & "&pwd=" & pw.Text & ""
MakeRequest ("False")
End Sub

Private Sub cmdok_Click()
List1.Clear
If rs.State = adStateClosed Then Exit Sub
rs.MoveFirst
tt = rs.RecordCount
ans = MsgBox(Replace(txtsms.Text, "<ARG1>", rs.fields(1).Value), vbYesNo, "SEND MESSAGE SAMPLE")
If ans = vbYes Then
Do While Not rs.EOF
        'URL = "<url to send sms>"
    'temporary codes for textin
    '
    URL = "" & userid.Text & "&password=" & pw.Text & "&message=" & Replace(txtsms.Text, "<ARG1>", rs.fields(1).Value) & "&mobileno=" & rs.fields(0).Value & "&masking=" & sendergsm.Text
   'URL = "" & userid.Text & "&pwd=" & pw.Text & "&ph=" & rs.fields(0).Value & "&sndr=" & sendergsm.Text & "&csndr=" & sendercdma.Text & "&text=" & Replace(txtsms.Text, "<ARG1>", rs.fields(1).Value)
    MakeRequest ("False")
    rs.MoveNext
    
Loop
End If
End Sub

Private Sub Command1_Click()

End Sub

Private Sub File1_Click()
If cn.State = adStateOpen Then cn.Close
If rs.State = adStateOpen Then rs.Close
rs.CursorLocation = adUseClient
Set dg.DataSource = rs
'  MsgBox rs(0)

  '============================method 1=================================
  cn.open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=" & PathtoTextFile & ";" & _
          "Extended Properties=""text;HDR=YES;FMT=Delimited"""
  rs.open "select * from " & File1.FileName & "", _
          cn, adOpenStatic, adLockReadOnly, adCmdText
  '============================method 2=================================
  'cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=" & PathtoMDB & "Northwind.mdb"
  'rs.Open "SELECT * FROM [Text;Database=" & PathtoTextFile & ";" & _
          "HDR=YES;FMT=Delimited].[textfile.txt]", _
          cn, adOpenStatic, adLockReadOnly, adCmdText
  '=====================================================================

rs.Requery

End Sub

Private Sub Form_Load()
PathtoTextFile = App.Path
  PathtoMDB = "C:\PathtoMDB\"
'  CmdOpen.Caption = "Open textfile and display field value"
 ' CmdInsert.Caption = "Insert textfile values into MDB"
End Sub

Private Sub sendergsm_KeyPress(KeyAscii As Integer)
'If KeyAscii >= 97 And KeyAscii <= 122 Then KeyAscii = KeyAscii - 32
End Sub

Private Sub txtsms_Change()
Label1.Caption = 160 - Len(txtsms.Text)
End Sub
Public Sub ProcessResponse()

    ' Receive the response from the server.

    Dim str As String

    'Set oXMLDoc = oHttpReq.responseXML

    str = oHttpReq.responseText

    'MsgBox str

    List1.AddItem str
   

End Sub
Private Sub MakeRequest(ByVal isAsync As Boolean)

    Set oHttpReq = New XMLHTTP30

    Dim xhrHandler As myHttpRequestHandlers

    Dim data As String

 

    If isAsync = True Then

        Set xhrHandler = New myHttpRequestHandlers

       

        ' Set a readyStateChange handler.

        oHttpReq.OnReadyStateChange = xhrHandler

    End If

       

  
    'URL = ""
   

    'MsgBox URL
    
    ' Open a connection and set up a request to the server.

   
    oHttpReq.open "POST", URL, isAsync ', "gurmukh", "dhbe34ds"

    ' Send the request to the server.

    Dim str As String

   
    'On Error Resume Next
    oHttpReq.send

       

    ' In a synchronous call, we must call ProcessResponse. In an

    ' asynchronous call, the OnReadyStateChange handler calls

    ' ProcessResponse.

    If isAsync = False Then

        ProcessResponse

    End If

End Sub

so find some bulk sms service provider and the will provide you there http api with that you can push sms easly

URL = "" & userid.Text & "&password=" & pw.Text & "&message=" & Replace(txtsms.Text, "<ARG1>", rs.fields(1).Value) & "&mobileno=" & rs.fields(0).Value & "&masking=" & sendergsm.Text
   'URL = "" & userid.Text & "&pwd=" & pw.Text & "&ph=" & rs.fields(0).Value & "&sndr=" & sendergsm.Text & "&csndr=" & sendercdma.Text & "&text=" & Replace(txtsms.Text, "<ARG1>", rs.fields(1).Value)
    MakeRequest ("False")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.